Question

I am working on a iOS project where user will be given a chance to record the videos. These videos will be part of the user's account. The user account info like name, email, avatar image, videos list etc will be saved in my server. Since my client is buying low storage space in the server, he don't want to keep the video files(each video is of 20 seconds only) in the server.

So I came up with making use of iCloud's storage space for video saving. Now the user accounts in the app comes from two places 1. The user meta data - my server. 2. The recorded video - iCloud server.

Now I have some questions on how to manage iCloud account with server account.

  1. How can I link iCloud account with server account?
  2. How to handle when user changes his iCloud account in the device but uses old server account.
  3. How to handle when user don't agree to save the video files in iCloud?
  4. How to handle when iCloud account runs out of memory.

Can some one who has worked on iCloud give me some answers to these type of questions then it would be really helpful for me.

Thanks

Was it helpful?

Solution

How can I link iCloud account with server account?

You don't. There's no public API that can link your server to iCloud and access the user's files. iCloud is not a web service, it's a system for syncing files and other data among different iOS devices used by the same person.

How to handle when user changes his iCloud account in the device but uses old server account.

In the app you can get a unique identifier for the iCloud account by calling [[NSFileManager defaultManager] ubiquityIdentityToken]. You can save the value, and later check to see if the current value matches the old one. If they're different, the user has changed accounts. There's also a notification called NSUbiquityIdentityDidChangeNotification that tells you if the account changes while the app is running.

This identifier will be different on different devices, even for the same iCloud account. It's not useful except on the device where you obtain its value.

How to handle when user don't agree to save the video files in iCloud?

Then... don't save them there. Your only other options are to save the videos on the user's device, or to upload them to a server somewhere. If your server can't handle them, you'll need to find a different one.

How to handle when iCloud account runs out of memory.

You won't be able to save any more files in the user's iCloud account. Your only real option is to ask them to delete some previous data to make space.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top