CloudKit storing and restoring data when testing, app is now released and users are losing their data - ios

I am using Swift. I can show my code if need be but there is a lot and it may be confusing and unnecessary (if you want to see if please let me know).
So my game needs to save things like high scores and purchases. When I am testing my app with Xcode, high scores get saved and I can delete the app, reinstall, and it pulls from CloudKit successfully. I submitted the application to Apple and they too found that the CloudKit purchase tracking system was working and let it go through to the app store. I told a few friends about my app and wanted them to test it a bit. For some reason though whenever they delete and reinstall the app all their data is lost! It is not performing the same way it does for me on Xcode (or for Apple for that matter).
The really annoying thing is that it takes 3-5 days for any updates I write to make it to the update and I can't even identify the problem yet because here on Xcode it works perfectly.
Does anyone know where the problem might lie? Where I might look in my code or places I could check?
Thanks!
Edit 1: Also a kind of follow up: A friend of mine is abroad and is always on airplane mode. When I check the CKContainerID on airplane mode when testing it finds the user perfectly. For him, however, it thinks that no user is signed in.
Why is all this different in production??
Edit 2: I'm finding some things regarding production cloudkit and development cloudkit? I am totally unfamiliar with this. Secondly I haven't messed around with the CloudKit Dashboard. My code basically tries to pull from the user's CloudKit and if it can't find those records then it will use the saveRecord function to create it.
Edit 3: Have just looked at this tutorial: https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CloudKitQuickStart/DeployingYourCloudKitApp/DeployingYourCloudKitApp.html#//apple_ref/doc/uid/TP40014987-CH10 and when I have followed those steps to deploy schema I see that the "changes to record types" lists every record I have. Does this mean that there currently are no records for production meaning no one can save anything? Do I just need to follow all these steps to deploy to development and I'm okay? I'm not too sure what this does so I am hesitant to do so.

Figured it out! Refer to my 3rd edit. Basically my data holders were all in the development cloud thus when users tried to save/pull their data there wasn't anything in the production cloud for them to save to/pull from. By following that little Apple tutorial and essentially pushing my schema from development to production my users were able to store their data about 10 minutes afterwords!

Related

Force removal/invalidation of iOS app from user devices

Assuming you created an app that users have downloaded that is just awful and you neither want to fix it nor have anyone continue to use it so that it won't tarnish your brand, is there a way to end its life on user's iOS devices?
Curious if there is some store setting to force it to work with earlier versions of iOS and invalidates the current app, or code that would force an update that says the app is no longer available.
As many have confirmed, there is no way to remove an application from someone's device. For these cases though, many companies have servers that the application sends a request to on launch, that returns either a need to update the app, a message, or to tell the user the app has been discontinued and that the app cannot be used anymore, stopping them from using the app from there on.
The last use case might be useful to you, but of course this is a proactive solution, not a reactive one.

Will my app update automatically or will user need to update the app when the code is updated?

I am creating a weather app and want to give local warnings to people through an app. I want to be able to give up to date warnings, but I am wondering: does updating information in Xcode get automatically pushed to the devices or will it need an update every time I put new information in?
If I understand your question correctly - you have an app, which warns people about some unexpected weather conditions?
You basically have two options:
Do a code push to your app every time you do a change. This is not supported by default in Swift and Xcode, and can only be done via some third-party integration or framework (e.g. React Native), and is generally a hard thing to implement.
Setup a back-end server and link it with your app, so the new information is downloaded from this back-end server dynamically.
The only suitable and easy thing to do for your use case seems to be option 2.

Security of app using Parse servers

I am using Parse servers for my app, and I am concerned about people getting into the code of the app and changing the code that communicates directly with Parse.
For example, if I save a score to the database and I want to update it with a new score by the user, I have to write that code within the app. However, if someone were to change the code and hardcode in a score that wasn't earned, they technically could.
Is there a way to prevent this?
(When I say getting into the code, there is a way to do this using a jailbroken device. I don't know if Apple has fixed this, but about a year ago someone I know showed me the code to an app that is on the App Store.)

Sending orders from website to iOS app

I try to explain as best as I can (and simplify a bit).
I have an iOS app, asking the user 5 questions, 1 to 5 in this order. The questions are inside the app and the answers are then sent to a server via AF networking. It all works well.
I want to develop a web site with these same questions so somebody can choose which questions to be asked and in which order, for example 2, 5 and 3 only and in this specific order. Of course it will vary with each user. I then need to send this information back to the app and I want it after that to be Internet independent. I mean the questions and order are sent to the app (downloading or uploading) but then the user doesn't need Internet anymore to answer the questions (if there is no Internet to upload answers to server, the answers are automatically already saved in my app).
This surely must be possible but I don't see how exactly.
Do I need to have the questions in my app (as now) or having them on the web site would be enough?
How do I tell iOS to do something from my web site?
...
I am not after a precise tutorial, just some ideas thrown together to get me started, please.
Thanks a lot in advance for your thoughts.
Do I need to have the questions in my app (as now) or having them on the web site would be enough?
It's a good idea to have them in the app, so if the app is first opened with no internet connection it will still be usable. Each time the app is opened it should try to get new data from the web service and update its internal store.
How do I tell iOS to do something from my web site?
Generally, you don't. The app checks at appropriate times (like each launch).
Based on your comment below, the app should ask the user for his details and that is the trigger to connect to the server and obtain the active questions and order information. This can then be stored locally and the question interface can be presented to the user. Note, you could also return the number of days that should be recorded from the server...
On the next launch, you check for the existence of stored active questions and order information, and if you have some you go direct to the question interface.
The user should be presented with an option to upload the results (at the appropriate time), and you should have a setting somewhere to clear everything (just to remove the data, but also if the user needs to 'login' with different details for a new test session - so the app will check with the server again).

iCloud and Core Data - How to debug?

I have an Library-style app which uses Core Data to store its data. Currently I am working on the integration of iCloud support.
I worked through several examples and the Apple docs and finally managed that an object created on device A is automatically synced to device B.
That is great but know I am experiencing the some problems: Some objects are synced and others are not and I have no idea how to debug this. Is there some way to "see" which data is transfered to iCloud, which data is stored in the cloud, and which data is downloaded from iCloud?
All I see at the moment is, that I create some NSManagedObject and store it to the ManagedContext/PersistentStore. I cannot see if it is transfered to the cloud and I cannot see the current content of the cloud. This makes it unpossible to debug the whole process.
So how to debug iCloud?
EDIT on 06/02/2015
I asked this question quite a while ago but it still gets some up votes or favorites. Therefore I would like to share some information I got meanwhile:
DO NOT USE iClOUD! I cannot tell you how many headacdhes and sleepless nights I had because of iCloud. It is jut not worth the candles. At least not when being used with Core Data. It just does not work reliably. This is even still true with iCloud Drive. My apps "supported" iCloud for about two years I did everything possible to get it running. Every time it seems to work I got new error messages from users. It worked fine for many users and caused trouble and even crashes for many othes. It was just terrible. Do your self a favour and use any other syncing service.
There seems to be a runtime argument
-com.apple.coredata.ubiquity.logLevel 3
check this article http://www.freelancemadscience.com/fmslabs_blog/2012/3/28/debug-settings-for-core-data-and-icloud.html?
tried the mitmproxy to see what is send and what is received?
There is a GameCenter tutorial at http://mitmproxy.org/doc/tutorials/gamecenter.html , it should be similar for iClound transfers.

Resources