Instruments - Target terminated too early to collect data - iphone

I am using my iPhone as a development device. Whenever I run an application on the iPhone with Instruments (Instruments->Launch Executable->my app), the app is launched but I get the error mentioned in the subject in Instruments.
I have tried removing the device from xcode and adding it again as a development device but I still get the same error. Can someone please tell me how to solve this.
Thanks.

Did a fresh certificate-provisioning profile routine and changed the bundle identifier to read myAppId.somethingForTheStar.${PRODUCT_NAME:identifier}
Also, if you open the mobileprovision in TextEdit and search for
<key>get-task-allow</key>
if the value for the key is true, make sure the option is checked in your Entitlements.plist file (though Apple developer portal says it should be unchecked - which it should ideally be, if your mobileprovision file wants it checked, keep it checked)
Strange, I had to use an Entitlements.plist with the "get-task-allow" checked for Debug profile and unchecked for Distribution profile for the respective profiles to work!
Hope that helps someone.

Does it crash normally? or only using Instruments?
I've had lots of oddness with instruments and app installation that was only fixed by a complete restore of the iPhone/iPod Touch.

I got it to work only with my development provisioning profile which is not my distribution profile.
I also made sure i have the same provisioning profile in project and target and turned
on get-task-allow in Entitlements.plist
It sometimes still doesn't work and then i restart xcode unplug/plugin my iphone, clean the target and run instruments from Xcode via 'Start with Performance Tool'
This is by the way with XCode 3.1 / SDK 3.0.
Hope this gets less painful with SDK 3.1 (which i'm downloading now).
Oh and yeah my app crashes sometimes during 'CPU Sampler' which i believe has to do with Instruments.

make sure you are compiling as debug and not release
also make sure you are using development profile for both project and target

Related

iPhone app crash immediately after update

today my app update it has been released in the store, when updated or downloaded for the first time the app immediately crash on start.
I've tested the app on simulator and on device (the same where I've installed the update from the store) and I never experienced this problem.
My update it has been submitted with Organizer after the archiving, in the Distribute section.
Apple do not perform these types of controls before to release an app?
Anyone experienced a similar problem? I have no idea what could be the cause..
Thank you, Stefano.
Here's the best way to test a production build without deploying to the store:
Set your build Scheme to "iOS Device"
Do an Archive build
Select your archive and click Distribute
Choose "Save for Enterprise or Ad-Hoc Deployment"
Pick your code signing cert
After saving the ipa file, use Apple's iPhone Configuration Utility(*) to install it on your device
You should always perform two tests:
installing on a blank device after uninstalling your app *and any profiles in Settings -> General -> Profiles"
installing over the top of the previous version of your app, to make sure any files/preferences/etc are properly converted to the new format
(*) the iPhone Configuration Utility is mostly used for enterprise app deployment, but it's also useful for developers and is available as a free download for mac and windows at support.apple.com. You can also use iTunes instead, but it's convoluted.
As for why your app is crashing? No idea... it could be anything. Standard debugging advice applies.
The issue is related to the Framework. I had this exact error. It wasn't a case of logic as it was crashing before the AppDelegate was even called and my usage of NSMetadataQuery was much later in the life cycle than that.
It turns out that weak linking the Foundation framework was required.
Problem was solved by changing (under the Project Info in Xcode) the dependency option of the Foundation.framework from required to optional. Check for any such frameworks.
Try deleting any old versions of the app you have on your device, and reinstall. Also try on a different device, maybe with a different apple id to your developer account.
This happened to our app also, and apparently, other apps too.
Apple is aware of the problem and is currently working on a solution.
see this article:
http://techcrunch.com/2012/07/05/apple-responds-to-app-crashing-issues-has-a-dedicated-team-working-on-a-fix/
If you are using core data & you have updated database in your latest version without versioning core data in that case app crashes on launch after update.

entitlement 'application-identifier' has value not permitted by a provisioning profile

I know this question is being asked several times, but I guess currently, I am little frustrated with this entire signing concept, which tends to be so tedious than even coding and sometimes hilarious how Apple have really messed it up in different versions. When I try to build the distribution ipa file from XCode 4.2, the ipa builds fine and can be installed successfully, however in XCode 4.3.2, the app never gets installed but gives me the error: Jun
: entitlement 'application-identifier' has value not permitted by a provisioning profile
Now, I am trying to build it through xcodebuild using my mobile.provision and everything seams to look fine until ipa is being generated. However, when installing the app through itunes, this is the error that keeps getting generated. After surfing through blogs/google_search/etc it seams there might be some issue with entitlements which I have no clue how to go and fix this or what might be an issue there anyways?
I hope someone can direct me to the right direction regarding a fix for this.
Thanks
The way I solved my problem was first, I was not signing the build with proper provisioning. You can indicate the path of the mobileprovision, or if its being added then simply you can goto XCode Organizer and select the correct provision, right click and show the provision in the finder. If you reflect the names in Organizer and in finder are totally different, and I am not sure why apple tends to keep it like that but that's where one error occurred. After that when I tried compiling and installing the ipa on the device, I encountered another error as "entitlement 'application-identifier' has value not permitted by a provisioning profile" as it is not a group member. After going through different blogs and searches it seamed like in Apple's technical note it indicated that if you are building your app for distribution the parameter in dist.plist file "get-task-allow" should be set to as FALSE. Although it indicates that in XCode 4.2, since entitlements is being taken care for you, the type of compilation you choose should reflect to that as well, but apparently that didn't reflected to FALSE. So after switching that to false, the ipa finally got installed to the device. Again, this is for enterprise distribution purpose, so hope in future this may help someone and save some hassle.
I fixed the problem for iOS10 enterprise deployment by removing my app extensions from my app, they were being code-signed differently to the app and was causing this issue.

No valid com.apple.developer.ubiquity-kvstore-identifier entitlement [duplicate]

I'm having a problem integrating iCloud with my app.
When I set test out iCloud availability, I receive Success for the function
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:#"AppID"];
but right after this, when I attempt to perform:
NSUbiquitousKeyValueStore *iCloudStore = [NSUbiquitousKeyValueStore defaultStore];
I receive the error
NSUbiquitousKeyValueStore error: no valid com.apple.developer.ubiquity-kvstore-identifier entitlement.
Any ideas on how to fix this? My App.Entitlements file is using the default macro'd prefixes, nothing changed from the auto-generated file. iCloud is definitely enabled on the AppID in iTunes Connect.
Thanks.
I had the same problem even though all of my code, settings, entitlements, etc were correct. I fixed it by physically deleting the app from my iPhone, then building in Xcode and running it on my iPhone and it worked. Just wanted to add that in case the other solutions don't work for somebody else out there.
Big warning: if your device is jailbroken, make sure you have uninstalled AppSync. I had two insane days because of that. iCloud (and Game Center) would not work on device with AppSync installed even with correct entitlements and profiles!
I did the follow to get this to work for me (Xcode 4.2.1):
In Xcode, go to your target > Summary > at the bottom, click Enable Entitlements.
In the iOS Provisioning Portal, go to App IDs and enabled iCloud support. (You may not have to do this, but it worked for me.)
Edit your Provisioning Profile to force it to update; then download this profile and open it so it automatically launches in Xcode.
Clean and build your app to your device.
I ran into this problem when attempting to debug a Mac (not iOS) application. The problem turned out to be that I was not signing the debug build, and did not have the deployment phase of the project with "Skip Install" set to "Yes".
Apparently, iCloud will not function properly with an unsigned application.
Add com.apple.developer.ubiquity-kvstore-identifier in your Entitlements with the following value:
$(TeamIdentifierPrefix)$(CFBundleIdentifier)

IPhone Development Profile Expired

I really combed this site and others. I read and re-read the related links here and the Apple docs. I'm sorry, but either I am obviously missing something right under my nose, or this Apple profile/certificate stuff is a bit convoluted. Here it is:
I have a product in the App Store.
I have updated it several times and users like it.
My development profile recently expired just when I was improving the app for its next release.
I can run the app in the simulator.
I can compile and put the distribution build on my iPhone just fine.
I went to the Apple portal and renewed the development profile.
I downloaded it and installed it in Xcode.
I see it in the Organize window.
I see it on my iPhone.
I CANNOT put the debug build on my iPhone to debug or run with Instruments. The message is that either there is not a valid signed profile or it is untrusted.
I subsequently tried to download and install the certificate to my Mac's keychain.
Still no success.
I checked the code signing section of Project settings and also for the target and the root. All appears to indicate that it is using the expected development profile for debug.
Yes, I had deleted the old profile from my iPhone, from the Organizer. I cleaned the Xcode cache and all targets. I have done all of this several times and in varying sequences to try to cover every possibility.
I am ready to do anything to be able to debug with Instruments in order to check for leaks or high memory usage. Even though the distribution compile runs fine on my iPhone and plays well with other running processes, I will not release anything without a leaks/memory test.
Any ideas will be appreciated. If I missed something obvious, please forgive me - it was not due to just posting a question without searching for similar postings.
Thanks!
All problems solved! I am very happy this all happened because I learned so much about Xcode, keychains, certs and provisioning. Unfortunately, there is not a simple answer. Here are the highlights:
I needed to recreate the ad-hoc profile and install it on my device. (That was MY BIG oversight and the reason the dist build no longer ran on my device.)
Between the very first time I created my profiles and the date my development profile expired, I upgraded to the 3.1.3 Xcode SDK.
It seems that this now means you need 2 entitlements files; a debug version with the get-task-allow checked and a distribution version with get-task-allow unchecked. Each need to be set in the respective settings.
In Project settings, I needed to set both my working directory and intermediate directory to the build product directory.
BIGGIE - I had to double click on the target and reset the appropriate code signing profile. There was an old profile name still there for some reason! Now, I can debug, and drop my distribution on my device without a hitch.
So, in summary, I believe that my original problem (not being able to debug after renewing my dev profile) and the problem that resulted from all my efforts to fix the first were caused by:
the fact that I upgraded to 3.1.3 during my dev cycle
my own oversight (I apologize to Apple for my criticism)
an Xcode quirk (the old profile name hanging around in target settings).
I hope this helps others. The best advise I can give is to take a day off and then create a new empty project, going through the same process step by step.
Thank you all!!
Try re-creating your development mobileprovision file on Apple's site. Be sure to delete all old copies from Organizer (including those on the iPhone itself).

Error Installing iPhone App on Device

I set up all my certificates and keys today and am trying to run my project on my iPhone.
I'm encountering this strange error:
Your mobile device has encountered an unexpected error (0xE800003A) during the install phase: Verifying application
Poking around the Apple Developer forums, I've attempted to set new certificates and provisioning profiles as well as editing Info.plist, but no matter what I do I can't seem to run the app on my device.
The only think I can currently think of is that my project name in Xcode differs slightly from my development provisioning profile (it uses a question mark), but I've named it according to Apple's conventions: com.mycompany.myapp, so I'm unsure if that's the problem.
Any ideas?
Edit: I've hard restarted the phone, rebooted Xcode, cleaed my targets, set up a new wildcard App ID and respective provisioning profile and still nothing. Any other ideas?
It turned out that I had 2 certs in keychain that were simultaneously overwriting each other! I hope this helps people in the future.
You should create a wildcard app ID; com.mycompany.*. That may help.
I've encountered this on many occasions. What i do is clean all targets, shut down xcode, and hard reboot my phone.
This is a different error than the more common problem of getting the cert wrong...
Restore the phone (using the XCode Organizer to reload the latest OS), to be safe do not restore from backup when you sync with iTunes the first time (it'll still keep your number when you sync even if you don't use the backup). I've had to do this a very few times, the last one was when it was in the middle of deployment when I unhooked the phone from the cable (had to answer a call).
Try the reboot (of the phone) first, hooking it up with XCode off. But if that does not solve things, restore is the way.
The console tab in the XCode Organizer sometimes gives helpful hints as to what happens during the install phase. In one case my problem was my app already existing on the phone. I deleted my app and the install succeeded.
Regardless, it looks like a lot of error messages are bundled into this one cryptic message and to really diagnose what is going on, I found the Console tab very useful...
One other thing to try is reinstalling the iPhone SDK. I ran into an error like this when I first got my developer key and this was the only way around.
Just want to say to everyone, when you go to edit Targets-> be sure to set "configuration" in the top left corner to "All Configurations" or the correct config you are building for (Debug or Release). You might think you have things set correctly but it will be for the wrong configuration.
I've seen that error on a correctly provisioned device that has had success installing apps from XCode before, and I've had luck restarting the device and trying again. Maybe that will help.
Try running in Release mode instead of Debug. I have a working project with this problem. No idea what the issue was, but running it in Release mode works, but Debug mode produces the error code.
I have a support ticket open with Apple dev support for the same problem, and (FWIW) I'll post their recommendations if and when they can get my toolchain working.
Try this: (source: http://ephemera.lifewithalacrity.com/iphone_development/)
Even though this is supposedly only for Distribution builds, it helped me to be able to install my Debug version on my iPhone again, after it mysteriously broke yesterday.
"just triple check that all the code signing in your project properties are clear or default"
Note, this is the PROJECT properties as opposed to the TARGET properties. I set my Code Signing Provisioning Profile back to the default and removed the Code Signing Identity string.