NSFileManager ubiquityIdentityToken returns nil unexpectedly? - ios

I am using this iCloud library within my application: https://github.com/iRareMedia/iCloudDocumentSync
On my iPhone running iOS 8, I run the app and ubiquityIdentityToken returns a value and everything works fine. However on my iPad running iOS 7.0.4, it returns nil.
I ensured a few things on the iPad:
The iPad is connected to wifi and can connect to the internet fine
iCloud is in fact set up on the iPad. I can see this because it says so in Settings and iCloud tabs are working in Safari.
The documents and data option is in fact enabled
Xcode set up iCloud automatically via the capabilities iCloud tab and it works on my iPhone with the same set up.
Is there any reason why this could be happening? It seems hard to believe that it can work on one device and not the next. Any help would be appreciated.

I'm not sure if this is your problem, but Apple does mention in What's New in iOS 8 that a user's iCloud data in iOS 8 is incompatible with iOS 7:
"The iCloud infrastructure is more robust and reliable when documents and data are transferred between user devices and the server. When a user installs iOS 8 and logs into the device with an iCloud account, the iCloud server performs a one-time migration of the documents and data in that user’s account. This migration involves copying the documents and data to a new version of the app’s container directory. This new container is accessible only to devices running iOS 8 or OS X v10.10. Devices running older operating systems will continue to have access to the original container, but changes made in that container will not appear in the new container and vice versa."
Edit:
To see if this is your problem, you should test on two iOS 8 devices and compare to two iOS 7 devices. If you are still running into the same issue on the same versions of iOS there is something else going on as well.

I know iOS 8 is still under NDA so this answer can't be as specific here as I would like it to be but I'll just say the following. This answer: https://stackoverflow.com/a/24584019/394736 points to this link: https://devforums.apple.com/thread/229509 and that fixed it for me on both iOS 7 and iOS 8 devices!

Related

How to confirm App Store will respect my minimum iOS version?

We have set the minimum version of our App to iOS 10 in the Deployment Target setting in its build target in Xcode. I want to confirm that someone running iOS 9 cannot download the app. The app is on the App Store already.
I have a device which I would like to load iOS 9 on in order to test this. I checked Xcode and I can only download iOS10 on the simulator. There are sites all over the place with .ipsw files I can download, however they are for jailbroken phones - they are not signed by Apple. I do not want to jailbreak the device. Anyway I think that would not even work as I couldn't get to the App Store anyway.
There are a few iOS device models where the maximum iOS version supported is iOS 9, such as the iPhone 4s, and equivalent vintage iPad. Apple still signs iOS re-installs on such devices. You might be able to borrow or buy a used one fairly cheaply, and use that for Deployment target testing.
There is nothing to confirm. An app with a deployment target of iOS 10 cannot under any circumstances run on iOS 9. It won’t be downloaded to an iOS 9 device. But you cannot prevent the downloading of the app in some other way (though it still cannot run on an iOS 9 device). So just believe in reality and move on.

Retrieve XCode Project from iOS app?

If I have an app I developed installed on my device, can I retrieve the original code?
I seem to have misplaced the XCode project between my different computers and hard drives for an old app I made. However, I still have the app installed on my iPad. I really need some of the code from this app. Can I possibly plug my iPad into my mac and retrieve some of the code from my iPad? (I know some stats are visible in iTunes. Can I view the app info there?)
A compiled app doesn't contain any of the app's Swift or Objective-C source code.

iCloud & iCloud Drive saving core data multiple devices with and without iOS 9

I have searched and searched but it is not entirely clear, I haven't programmed much in years, I have to update an old app for a client that will be using iPods iOS 6 and new iPhones with iOS 9 logged into the same iCloud account.
Will changes to core data of app on an iOS 6 device update content for the iOS 9 device?
I have not experienced problems with updates to iCloud in NSSUserDefaults when testing on iOS 6 and ios9 devices (with iCloud drive disabled)
I cannot get iCloud for core data to work on ios9 iCloud drive disabled, so I need to update to iCloud Drive... But I am worried about data on other devices not updated. Debugging nightmare?
Core Data with iCloud is really flaky, I really don't recommend it.
Devices that have switched to iCloud Drive will make changes that won't be visible to those that haven't (including those devices that don't support it, most definitely those running iOS 6). Not sure about the opposite, but it's probably the case as well.

updating my app to only support iOS 4.3+, what happens to users running iOS < 4.3?

This seems like a question that should have a lot of answers on Google, but I can not find an answer to this....
I am updating my app to only support iOS 4.3 or later. What happens to users that currently have my app installed and are using iOS < 4.3. Does the app remain installed on their devices and they are just not eligible for updates?
They will not be able to update the app, I believe there will then be a permanent "1" on the AppStore icon. If the user downloads the update in their desktop iTunes, it will overwrite the old version and they'll never be able to install that version on their devices.
As long as they don't restore their iOS (wipe the phone) the app will remain.
EDIT:
There is no reason now to support "4.3+". Any device that canrun 4.3+ can run 5.0+, and any device that can run 5.0+ can run 6.0+.
Staying under 4.3 for iPhone 3G is fine, but if you now support 4.3+ you've really gained nothing other than alienating iPhone 3G users for no benefit.
In other words, users who are still on 4.3 are probably not the type of users who are updating apps from the App Store anyway.

Testing iCloud sync with a single iOS device

I have just one iOS device at the moment, and it hasn't been a problem so far. But I now want to add iCloud sync support to my app (which uses Core Data).
Will testing be simply impossible until I get a second device? Or is it possible to use iOS Simulator in conjunction with my device or to fake iCloud data in order to test iCloud sync?
Edit: It doesn't take much research to find that iCloud, especially with Core Data, definitely requires extensive testing and that certainly means testing with more than one device!
In Xcode 5:
OS Simulator now supports iCloud syncing of documents and KVS data
within an app, enabling apps to sync between devices using iCloud.
This feature is useful when testing to ensure that the app documents
and data are syncing properly across multiple devices.
Note: With the app running in the iOS Simulator, sign in to an Apple
ID account using the Settings app. After signing in, use the “Trigger
iCloud sync” command in the Debug menu to tell the simulator to sync
with other devices.
You could use your mac as the second device and take the backend of your iOS core data code and write a test app for the mac. You will have to run the app as a sandboxed app in xcode and put the same sandbox name in the app settings for the apps to see each others data.
To make this work you need to create a mac app up on the provisioning portal (requires a mac developer license 99 bucks - cheaper than an iOS device) and enable it for iCloud.
In general unless you are going to try and manage merge conflicts in your app, you dont need to test iCloud itself. Anything that is in the ubiquity container will in fact be synced. If you need transactional control across devices (same documents being updated on multiple devices at the same time for the same user, you would have to handle conflicts), depending on what your app does it might be an issue.
One way you could test at least a sub-set of your syncing is to install your app on your device, add some data, sync that data to iCloud, then delete the app from the device.
When you install it again and sync to iCloud, you should then get back the same data you previously synced up to iCloud.
It's not exactly real-time, but it should give you something to work with.

Resources