Using iCloud in iOS Simulator - ios5

In my App, when I try to run code in the iOS Simulator:
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:#"2VHM28566N.com.eept.TestICloud"];
NSLog(#"IS ICloud : %#", [iCloudURL absoluteString]);
It shows that iCloudURL is nil.
Can we use iCloud without an iPhone device?

I tried to run my iCloud app today on the simulator and there is no option to enable iCloud in the simulator as far as I can see. I looked in settings, but no luck. So the answer would be no, you can't really test iCloud unless you test it on an actual device.
If anyone has a workaround, that would be fabulous. It's a bit tedious to always test your app on the device.

In Xcode 5:
iOS 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.

I know this is an old topic, but you can test iCloud by changing your deployment target to 'Device'. Plug your device in via USB and let the fun begin.
I would imagine that this is done for security reasons, and for a very good reason at that.
Because your device will have a mobile provisioning certificate which ties up with your iCloud 'bucket' as well as your App Bundle ID, it ensures that only you (your app and allowed devices) have access to your provisioned iCloud bucket.
If you could run it on the simulator without having all of these certificates and ID's in place, you could easily get a team ID from any other app which you download, slap together a project using that identifier and without a certificate marrying up developer, with iCloud bucket, you'd get full access to another App's bucket.
All I did to get around this was order a 5m USB extension so I can have my iPads, iPods and iPhones on the desk in front of me without having to crouch under a desk or sit in awkward positions whilst testing.
edit Just to add an slightly clearer answer as to what allthewayapps asks about the bundle ID.
2VHM28566N.com.eept.TestICloud
is made up of 3 parts in this case:
2VHM28566N - Being the TeamID which Apple assign you when you register as a developer
com.eept - Reverse domain notation of the App's related website i.e. Apple apps would have com.apple
TestICloud - The name of that app itself.
In short its:
teamid.com.yourdomain.appname
Hope this helps.

Related

How to test iphone app on remote location

I have created an iPhone application. I don't have the iPhone and I want to test the application on the iPhone of my friend who is far from me. How can I test it on his iPhone?
When I searched on google, it told me that you need to have the device with you. Is it possible to send the wrap and send the application to a remote location and get tested from there? I also have the Apple ID and license.
Yes with a tool like TestFlight you will be able to check wether or not your will work on a device. Thus is good for acceptance testing but never for technical working of an app.
But when it comes to really testing a device is needed, there is not way around it. You should do performance testing on a device.
Also there is no way to use the debugger unless it is connected to your development machine.
If you are developing for iOS get an iOS device.
It's possible, check Test Flight:
https://testflightapp.com/
I used it in the past for the same scenario as you
You should have a device yourself for testing on, before you publish anything in the App Store. Testing in the simulator is just not the same as testing on a device.
On developer.apple.com you will need to create a Ad Hoc distribution profile. You will also need to add all the devices you want to run the app on to this profile. Once you have the profile and you have it installed in Xcode, you can run an Archive build and sign it with the distribution profile. After this you can select the archive and click on 'Distribute...' to generate a .ipa file.
Once you have this .ipa file, you could use a site like testflightapp.com to distribute the app to test-devices. (you could also just email it ;-) )
If you are looking for just a way to transfer the ipa to someone else the best simplest solution for that would be http://www.diawi.com/ or https://appsendr.com
Get the target Device UDID and add it to your testing list, Create your IPA, drag it to the site above, Done.
No need to signup or anything like that.
I like appsendr better because of the small app they provide.
Lets you drag the IPA to your tool bar and have the ipa url right in your clipboard once it's uploaded.

Two iCloud devices get different results with NSMetaDataQuery

I'm using iCloud to store small audio files with a simple UIDocument class. Running iOS 5.1 on an iPhone 4s and an iPad 1. The iPad is communicating properly with the iCloud container. As I create documents, I see them pop into the iCloud store from Settings->iCloud->Storage&Backup->ManageStorage->MyAppName on both the iPhone and the iPad. The iPhone, however, seems to be connecting to it's own separate store. Files I create there do not show up in Settings on either device but appear to go to some container somewhere. I can see them when running an NSMetaDataQuery (but I don't see the documents from the real iCloud container).
How the problem began:
When I first created the iCloud entitlement and container identifier, I omitted the "com." prefix from the store name. This worked fine until I submitted an app update to Apple and they immediately rejected the upload citing an invalid iCloud container identifier. My problems began after I changed the identifier. I have deleted and reloaded the app on both devices, but the iPhone is still stuck using what appears to be an invisible iCloud container.
Please help me get my phone back in sync with the real iCloud container. Thanks!
This appears to be an Apple bug with iCloud. I restored my iPhone 4s to its original settings and everything now works fine.

Why can't our app store a simple key/value pair in iCloud?

I've configured our app for iCloud usage with the appropriate entitlements, under a provisioning profile that is set up for iCloud, and a developer profile that's associated with this provisioning profile.
The application identifier matches what's specified in the provisioning profile (com.ourcompany.ourproduct). I don't get any errors when building the app.
iCloud is enabled on my phone, and is working (as evidenced by my calendar, contacts, and bookmarks being updated).
And yet this fails (localID is a valid NSString):
NSUbiquitousKeyValueStore* iCloudStore = [NSUbiquitousKeyValueStore
defaultStore];
[iCloudStore setString:localID forKey:#"ourKey"];
If I call synchronize after this, it returns NO. If I allow plenty of
time for the update to occur, subsequent attempts to retrieve the data
still fail.
Any idea what the culprit could be here?
Thanks!
In the simulator, NSUbiquitousKeyValueStore will just store values on disk and won't even try to synchronize anything.
On the device, synchronize will generally fail because your kvstore-identifier entitlement is incorrectly set but you should then see an error log in your Console.
Are you running it in the simulator? iCloud sync doesn't appear to work in the simulator, only on a device. Beyond that, your code looks good. I would expect it to work.
I also noticed that I was able to store and retrieve keys even before I set up my entitlements. I'm assuming the entitlements just allow you to link a key-value store to your App ID so that multiple devices or multiple apps from your company can share a store.
Knowing this, you could try completely removing references to iCloud in your entitlements and see if that works. Just for testing purposes.

Backing up iphone app while still developing (before its on the app store)

I am developing an iphone / ipad application. My plan is to have my beta customers use it before I have submitted it to the app store to help me work out all the issues.
Nonetheless, they will be entering real information to the application. Thus, I would like them to be able to back up the application to iTunes using the sync feature.
I expected this would work normally, but as it turns out, I don't see the application in the list of apps that can by synched. My guess is that this is because I'm using a development provisioning profile.
Can anyone confirm this guess? Or better yet, has anyone out there successfully synched an app that is under development (not yet in the app store).
Thanks in advance.
Yes, I think you are right.
You need to build your app signed not as developer but with adhoc distribution certificate. You can find more about it on iPhone Developers Portal. Then you can find your app on your disk. You and your beta-testers can install your app via iTunes -
Drag and Drop your adhoc certificate file on iTunes
Drag and Drop your app package on iTunes.
Sync iPhone with iTunes - and you have your app installed and sync.
Backing up data to iTunes works just fine for me. I'm installing the app with my development certificate--not with ad hoc distribution. But, you'll probably want to use ad hoc to send the app to your testers, so some of this won't apply (see below if you're interested).
I can tell you that one of the biggest categories of support requests I get is people having issues with losing data after upgrading their device, the OS on their device, or my app. It might be a good idea to give your users a way to back up their data, whether it's Dropbox integration, a custom server, or some other solution.
On a number of occasions, I've upgraded the OS on my iOS devices and had the data come back when I restore the device after the upgrade, even for apps installed using my developer certificate. If you're really unsure, you can always back up your data using the XCode organizer (go to the organizer, select the device, find your app under Applications, expand it, and press the arrow button to the right of Application Data), back up your device using iTunes, and then do a restore using either XCode or iTunes. The data should be there after you re-install the app using XCode (the iTunes backup restore will restore the data, but not the app).

How can I install our iPhone project without connect the device but only using device ID?

I want to build my iPhone app only using device ID without connecting the device to my apple PC. Can I do this?
You can use the simulator, and never develop on the device. Is that what you mean? I wouldn't like to be one of your customers when I bought that app from the appstore in that case though - there would be so many defects.
If you don't mean that, how would you get the app on your device? I'm confused.
Are you suggesting that you do not want to test your app on a real device before releasing it? Please don't do that. There are a lot of differences when testing the app on a device or on simulator.
If you want to create a build for adhoc testing without connecting a device to your mac, you can do that by simply creating a mobileprovision file for adhoc testing where you can specify upto 100 device ids. For this you need to be a member of the Apple Developer Program though.
If I read your question right, you want to put your app on your phone without actually connecting your phone?
If so, it is not possible. You must connect your phone to load applications you develop.
if you are registered iPhone developer, u can create Ad Hoc distribution via defining device ids that you want the app to be used (steps are listed at 'Program Portal User Guide' at apple's developer site). then u can install the app on your device via iTunes.
Well, you can't install just based on the device number or something else.
There are two solutions:
1/But what you can do without plugging the phone is to Post your App on some testing platform like TestFlight, or Answers. And you enter users' email address and they can get the email.
2/You can set up a config file that declare your OS X Server address. And add the iPhone into your Server Open Directory. Then you can send and deploy the app to iPhone devices.
If you have future questions, comment.