Two iCloud devices get different results with NSMetaDataQuery - ios5

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.

Related

No 4inch support from Launch Image when doing Ad Hoc distribution

I'm using Xcode 4.6.3 and I'm sending the app to the client via Ad Hoc for testing and approval.
However, I've just updated the Launch Images and while it works fine when I run it from Xcode, and the 4-inch Launch image shows in the Target Summary, my client has shown me screenshots of the built app running in 3.5inch mode (which is definitely linked to a lack of a 4inch launch image). It's a little bit confusing really as I've named the file correctly (default-568h#2x.png) and it works on clean installs on both the Simulator and on my Test device.
I've also cleaned the project and project folder several times to no avail. I've checked the Copy Bundle Resources and the original default images aren't there and my new ones are (which is how it should be). I'm completely out of ideas, does anyone know why when it's being archived and distributed (I can't actually get the archived build onto my iPhone as my iTunes is not synced correctly with my phone) the launch image isn't being included thus forcing the app to run in 3.5inch mode?
Thanks,
Mike
It should be Default-568h#2x.png, just as the other default images are Default.png and Default#2x.png.
The reason that it works on the simulator and not on the device is the the simulator is not case sensitive, but the device is case sensitive, so you need to use the proper case for file names.

iPhone - which location the crash log is saved in iPhone app

I'd like to access the crash log in iPhone app without Third Party library.
Do you know where the crash log is saved in iPhone app?
I know the iPhone app folder structure is as followed:
Documents/
Library/
Preferences/
MyApp.app/
Default.png
icon.png
Info.plist
tmp/
EDIT:
If the crashes are not stored in Application folder,
do you know how UKCrashReporter and other third party library do that?
You need to be connected to iPhone device and Select Window -> Organizer -> Device Logs.
I have a jailbroken iOS device, so I can answer the first part of your question easily (although you may have already done so yourself). The standard crash logs are stored on the device in the following folder:
/private/var/mobile/Library/Logs/CrashReporter/
If you don't have a jailbroken device and the logs aren't visible in Xcode, you should be able to access the files with a iOS file explorer like i-FunBox, which should be able to access the file system even without jailbreak.
As for the second part of your question, I would think that at least some third party crash reporters save the crash data in the app's folder itself, judging by the following directories (which were empty as the app has not yet crashed on my device):
// ... was the identifier for the app path, removed for readability
/private/var/mobile/Applications/.../Library/Caches/com.plausiblelabs.crashreporter.data
/private/var/mobile/Applications/.../Library/Caches/com.plausiblelabs.crashreporter.data/SkobblerUS
/private/var/mobile/Applications/.../Library/Caches/com.plausiblelabs.crashreporter.data/SkobblerUS/queued_reports
/private/var/mobile/Applications/.../Library/Caches/crashes
Again this is something you could verify with an iOS file browser.

iPhone Simulator: App/Documents disappear

Is it standard that a XCode-Build empties the documents folder of the app on iphone simulator?
How can I prevent that?
when ever you re-build the application or make any other application with same app id ,the document folder for that is not erased .It will be removed only when the app is removed from the simulator.

Using iCloud in iOS Simulator

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.

iPhone App fails to properly ??copy? database file ONLY with ad-hoc or app-store distribution and NOT in development mode

I just submitted this to Apple Support, but I'm wondering if anyone here has encountered something similar.
SUMMARY: my iphone app crashes when downloaded from the iTunes app store or from an ad-hoc distribution, but doesn't "crash" when run in debug mode on the simulator or on my iPod
DETAILS: The app contains a rather large sqlite database file (~180 meg uncompressed, 56 meg compressed). This may be relevant.
When launched, the application should copy the database (if necessary). After this, the user should be presented with a table-view containing approximately 6,000 rows. The information presented within these rows is derived from reading a table within the aforementioned database.
This all works properly when I run the application in the iPhone simulator and also when I run the application in debug mode on my iPod.
The app was approved by Apple. However, when users began to download the app through iTunes, I began receiving emails saying that the UITableView was not populated with any information. To investigate, I downloaded a copy of the app from the app store and I saw a similar result (i.e., UITableView is displayed, but the rows are empty).
I believe I am able to reproduce the problem using an ad-hoc distribution of my app.
The ad-hoc distribution behaves similarly (i.e. shows no rows in the UITableView) to the app-store download. Specifically, I have done the following multiple times (I delete and reinstall the application each time).
add my ad-hoc provisioning
certificate to iTunes
add my ad-hoc app build to iTunes
sync my iPod Touch with iTunes
start my ad-hoc app
app seems to always crash upon the first startup (i.e., the splash screen shows for a second and then I see the home screen of my iPod Touch)
second and subsequent start-ups of the ad-hoc app do not crash, but the UITableView is empty.
None of this happens when I run the app on the simulator or when I deploy in development/debug mode on the same iPod.
I have tried to examine crash logs associated with the initial crashing of the app (see step 5 above), but no crash log is created at that point in time. HOWEVER, a crash log is created when I sync iTunes with my iPod Touch, but it might as well be written in Polish.
So, it appears as though the app-store reviewers who approved my app only examined the behavior of the application using the simulator and/or in development/debug mode. It's possible that the issue is related to the large size of the database file, but this is complete speculation on my part. To the best of my understanding there should not be a limit on app-size or database size near 180 meg. This also wouldn't necessarily explain why the app works in debug/development mode.
Has anyone seen anything similar?
I think I figured this out (haven't tested it yet)...
Turns out the entire crash log isn't written in polish.
There's a part that says that the "application failed to launch in time"
I suspect that my database is too large to be copied during launch of the application.
to quote apple: ***iPhone OS uses a watchdog timer when applications are launched. If an application takes too long to complete its initial startup, the operating system terminates the application. Applications terminated for this reason will have the exception code 0x8badf00d and related information noted in the associated crash report:*
*When Xcode launches an application, the watchdog timer is disabled to compensate for additional overhead that may be incurred when Xcode attaches the debugger. As a result, your application's long startup may initially escape your attention if you are exclusively testing by running from Xcode.***