Forum Xamarin.iOS

Xamarin IOS app, the restore function in my app from iCloud will not work once on the App Store

seattlesteveseattlesteve Member ✭✭

My IOS app is now on the Apple App Store. I tested it like crazy before it was put on the App Store and I am sure Apple did as well, but now that it is on the App Store, when I install it from there, the restore function I wrote to restore the applications data from iCloud does not work. The backup function works, as I can see the iCloud usage on my phone for my app contains 78mb of data, but the restore does not work at all, it just goes back to the home page. I have no idea why as I get nothing reported on the crash.

2 questions

  1. Is there a way to look at why it is crashing on my phone
  2. Any idea why it would stop working once installed from the App Store when it must have worked for apple when they tested it and worked for me as well before on the App Store?

Answers

  • Y3z1Y3z1 Member ✭✭

    You can check the device log (in Xamarin Studio's menu View -> Pads -> iOS Device Log), many times additional information will be printed there. You'll also usually get a crash report, which can be viewed from Xcode's Organizer (menu Window -> Devices, select your device on the left and click "View Device Logs").

    Check the link:
    https://forums.xamarin.com/discussion/66446/how-to-get-more-information-when-the-app-crashes

  • seattlesteveseattlesteve Member ✭✭
    Sorry for my ignorance, but what is Xamarin Studio and how do I get it. I have looked in Xcode and there are no crash reports. I did my development on my Windows PC using VS 2019 if that makes a difference. I do however have a Mac which I used for the deployment to the App Store.

    Your help is much appreciated!
  • seattlesteveseattlesteve Member ✭✭

    So a crash report finally showed up in Xcode, but since I did not do my code using Xcode, each message when I click on it, shows me nothing as it try's to go to the source code which is not on the Mac. The messages are completely cryptic and tell me nothing helpful. What can I do to figure out what is going on with my app, any ideas?

  • seattlesteveseattlesteve Member ✭✭

    So I found the issue on the App Center on my windows machine, it is not the restore at all, each of my records I am writing out to the iCloud is rejected so there is nothing to restore. The error just says error writing record and then gives the record information of the record trying to be written which looks fine to me. So what I am wondering, is there something special I need to do when my app is set to Production in order to write out a record? I am using the following code.

    ThisApp.PrivateDatabase.SaveRecord(newRecord, (record, err) =>
        {
    
                        //Analytics.TrackEvent("In Save Record");
    
    
                        // Was there an error?                                      
                        if (err != null)
                        {
                            Analytics.TrackEvent("Error = " + err);
                            Crashes.GenerateTestCrash();
                        }
                    });
    

    Any help would be much appreciated.

  • LandLuLandLu Member, Xamarin Team Xamurai

    It looks good with the code you posted.
    The tutorial tells how to save records here:
    https://docs.microsoft.com/en-us/xamarin/ios/data-cloud/intro-to-cloudkit#saving-a-record
    Did it ever work when debugging?

  • seattlesteveseattlesteve Member ✭✭
    Yes, this works perfectly in debug, however it didn’t work in TestFlight but I thought it was because it could not write to the production iCloud dashboard, as I read that wouldn’t work there, but assumed it would be fine once on the app store. I also assumed if it passed apple’s scrutiny then it worked in production. The code I wrote looks exactly like the example you gave except I am writing to the private iCloud not public. Do I have to write to the public one? Let me know, thanks!
Sign In or Register to comment.