Building iPhone App for Distribution - iphone

I have a question on how exactly to do the final distribution build for my app. I have actually successfully built this app already but now I am trying to make an updated version and to remember what I did right the first time. It all seemed to go wrong when my provisioning profile expired....
Anyway, I have my distribution certificate and distribution provisioning profile. I have followed the instructions from Apple, an iPhone programming book and several online sources to create a build that checks against the right certificate etc. But the build always fails unless I connect a device, which is strange as the distribution provisioning profiles do not allow the inclusion of a device (which makes perfect sense in itself). However when I build with a device connected I am asked
'Can’t run XXX on the iPod “iPod
touch”
The iPod “iPod touch” doesn’t have the
provisioning profile with which the
application was signed.
Click “Install and Run” to install the
provisioning profile XXX on “iPod
touch” and continue running XXX.'
When I click install and run it fails with the message that
A valid provisioning profile for this
executable was not found.
So my basic question is how exactly should the final distribution build be done? An new executable appears, but it has a forbidden symbol on top of the application icon suggesting the build was unsuccessful.
Any help massively appreciated.

Don't click "Build and Go".
Either just build, and then locate the app and upload it, or use Xcode's "Build and Archive" option.
It is best to use "Build and Archive" as Xcode will look after the app bundle, and the important .dSYM file which is used to symbolicate crash reports for your app.

And you cannot upload and execute app that signed with 'Distribution' certificate on your device. Such app can only be uploaded to AppStore.

Related

How to configure a Xcode project for beta testing with TestFlightApp?

I signed up for TestFlight.
Then I followed all steps in this tutorial:
But Xcode throws this warning:
Application failed codesign verification. The signature was invalid,
contains disallowed entitlements, or it was not signed with an iPhone
Distribution Certificate. (-19011)
It smells like there is a lot more work to do than what they wrote in the tutorial.
Is there a complete tutorial which walks through every step without stepping over anything?
And do I need to add the SDK even for simple beta tests?
(Edit: No, SDK is not needed!)
Start with logging into the Provisioning Portal, and adding a test device or two, under Devices. Then go to Provisioning and create a new one for the appID you are working on and add those devices.
Back to Xcode and use the Organizer:Devices:Provisioning Profiles to download (refresh) the Provisioning Profile. Set your project's Debug scheme's signing to use that developer profile. You should then be able to build and then archive. Once archived, do an ad hoc distribution and save off that file to the desktop.
Go to your account on TestFlightApp.com and press the Upload Build button. Drop the file you saved on your desktop, into the Build upload area. TestFlightApp will give you errors if the app wasn't bundled for adhoc or signed properly.
Now, here is where TestFlightApp.com will save you work. Send out invites to friends from within TestFlightApp.com. TestFlightApp.com will manage notifying them and as they create an account, it will also help them find their UDIDs. These UDID's can be batched up and later downloaded by you and re-uploaded to the Apple Provisioning Center, into your devices section.
You then use Xcode to refresh your profiles, and rebuild the app, archive, and upload to testflightapp. Then you can select which one of your testers will get to see this build and what message they should be sent. Your testers will not have to figure out how to download the files and install them using iTunes or other app, they merely press the install button.
Believe me, while it is still a bit of work, it is so much better than not using TestFlightApp.com, especially if your users are not very savvy about app installation. In the future, you can use the TestFLight SDK to gather crash reports and usage information for your debug builds.
See the following for some more info: TestFlight beta-testing iOS app

iPhone Development - Running apps on device

I am trying to run the app on my device and there seems to be a problem with the code signing entity. If I choose the developer profile in the code signing entity, it runs fine but if I choose the distribution profile (I've tried both the Adhoc and Appstore distribution) it says "Build Succeeded" but it gives a popup error message saying -
Error Starting Executable “App Name : Device Name”
Error launching remote program: failed to get the task for process 3273
Am I supposed to see this or am I doing something wrong again ?
Thanks
You can not test and run the application with distribution profile at your end. The distribution profile is just for signing the project ipa and upload it to the app store. For running onto your device, only developer profile will work.
If you want to test application on device, then you need to create debug profile for it. You need to get it for your device from the provisioning section of developer portal. If you are creating the distribution profile, then you need to put the generated ipa file from build folder to itunes to install it on device.
Then you can install the application on device. But in that case you will not be able to see the logs.
So if you want to see the logs in Xcode console, Create a developer provisioning profile for the device & install it on XCode & then run the code on device using Xcode.
I think this is the entitlements.plist problem please follow the steps
In XCode, go to "new file" and select "code signing" in left box. Select the "Entitlements" file type. And change the name to "Entitlements.plist". Give the name in project getinfo entitlements plist please check the image below

A valid provisioning profile for this executable was not found: only with distribution

I'm releasing a new version of my iphone app and everything was going great until I changed the settings to "distribution" and "device", and then got the error:
A valid provisioning profile for this executable was not found.
This doesn't make sense as I am able to install the app onto my phone in debug or release mode, but not in distribution mode. Is this error because the provisioning profile and distribution profile are not compatible? Or what could be a solution?
Back history... I DID just get a new iPhone 4 a month ago and this is the first distribution I have done with this device. Xcode is also telling me:
The iPhone “X” doesn’t have the provisioning profile with which the application was signed.
Click “Install and Run” to install the provisioning profile “Y Distribution Profile” on “X iPhone” and continue running “Z.app”.
Can anyone help? I'm going nuts and tired of running into a wall. Thanks in advance!!!!
What I needed to do was "build" instead of "build and run"
I use the distribution provisioning profile and found that the apps are not put on device with the distribution profile.
Distribution profiles aren't used to put on devices i believe? I've only ever used the distribution to build to upload to the app store.
When you get a new device you also need to remember to add it to the profile and then redownload it.
1-Xcode->Click your app -> TARGETS -> click the app-> Build Setting-> Code Signing : Make sure that both "Debug" and "Any iOS SDK" are set to "iPhone Development"
2- Xcode -> Product -> Scheme -> Edit Scheme: Make sure "Build Configuration" is set to “Debug".
You cannot run your app on a device using the distribution profile, which is really used for uploading the app to App Store [for distribution]. However, if you want to "simulate" how the app would behave in a production environment, what you need is a so-called "Ad-Hoc Provisioning Profile", which is really a lot like a distribution profile, but will allow the app to run only on designated devices without the need for XCode.
Check this link out for more detailed info.
Exporting Your App for Testing (iOS, tvOS, watchOS)
That's the expected behavior. When building for Distribution, make sure you select "Build", not "Build & Go".

Application failed codesign verification. What do I do?

Xcode gives me this warning when I build the app for release.
Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
Do I need to delete all entries from my keychain and redo getting a certificate, provisioning profile, etc?
I can build and debug on the iPhone and iPad without a problem.
If you know how I can solve this dilemma, please provide exact steps or a way for me to contact you about this.
Thanks
----UPDATE -----
Build Log
Validate build/Release-iphoneos/iApp.app
cd "/Users/iosdeveloper/Documents/Programming/iPad/iApp HD"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation "/Users/iosdeveloper/Documents/Programming/iPad/iApp HD/build/Release-iphoneos/iApp.app"
warning: Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
Executable=/Users/iosdeveloper/Documents/Programming/iPad/iApp HD/build/Release-iphoneos/iApp.app/iApp
codesign_wrapper-0.7.10: using Apple CA for profile evaluation
/Users/iosdeveloper/Documents/Programming/iPad/iApp HD/build/Release-iphoneos/iApp.app: valid on disk
/Users/iosdeveloper/Documents/Programming/iPad/iApp HD/build/Release-iphoneos/iApp.app: satisfies its Designated Requirement
test-requirement: failed to satisfy code requirement(s)
codesign_wrapper-0.7.10: failed to execute codesign(1)
- (null)
Here's the checklist I go through when I've hit this:
Clean all targets, exit Xcode, then go drag the build folder from your project to the trash.
Do the Get Info on your project, make sure the Code Signing Entitlements and Code Signing Identity are selected correctly. Do the same for your Targets.
Login to the iOS Provisioning Portal and make sure the Distribution certificate has not expired. Also check the Distribution Provisioning Profile and make sure it is Active. Make sure the Certificate is properly in your Keychain and the Distribution profile is in Xcode Organizer (if you have multiple of the same one, delete all but the correct one and redo step #2).
Look at your Build Results on the failure and identify which profile it is actually using and make sure it is the right one.
You probably need to check what code signing profile is selected in your distribution build properties.
It looks like your target is "Development" but Xcode applied some of distribution settings to it, so the warning simply means your ad-hoc build has no valid AppStore submission certificate. Go to your target settings, choose the Release configuration and uncheck "Validate Built Product" option.
Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
i am got the Same Warning Message...
I just Changed to iOs Deployment target 4.3 to 3.2.2 its works perfectly .....
Note: you may have to go to XCode's "Project" and select "Edit Active Target (appname)",
which is near the bottom of the list ... in the new pane that opens, select "Build", then
under "Code Signing Identity" select your distribution provision. Note that this seems
to be editing a different thing than "Project" / "Edit Project" (editing "target" instead
of "project"). I found I had to edit both project and target's code signing identities.
I had exactly the same problem. It was due to installing Xcode 4.0.2 and 4.2 preview 3 at the same time. Removed both (through the provided uninstall scripts):
<Xcodedir>/Library/uninstall-devtools --mode=all
Then rebooted and installed 4.0.2 and it works :/
I have found the codesign process a headache - I always shudder when I get am ready to use Ad Hoc distribution to beta test. After the usual round of errors and failed fix attempts I ignored the "application failed codesign" error and sent the build to a beta tester. It worked without issue.
Very frustrating.
In the build log provided in the -UPDATE- section of the original post the root cause of the failed signature verification is expressed with the text:
"test-requirement: code failed to satisfy specified code requirement(s)". That particular flavor of failed signature verification is almost always caused by mistakenly signing your app with an iPhone Developer profile instead of an iPhone Distribution profile.
It can be confirmed with the steps in "How do I verify the certificate that was used to sign my app?". If the certificate "Identity" is "iPhone Developer: YOUR_NAME" instead of "iPhone Distribution: ..." that is the reason for the "Application failed codesign verification" error, and you can resolve it by performing the following steps:
1a). if you have not yet created an App Store Distribution Provisioning Profile yet, that is done on the "Distribution" tab of the "Provisioning" Section of the iOS Portal site.
Note, the "Distribution" tab is only available to Team Members whose role is either "Agent" (the one who signed up for the iOS Developer Program), or "Admin" (those that the Agent grant access to app-distribution capabilities).
1b). if you're fairly certain you have an App Store Distribution Provisioning Profile installed in your Xcode profile library, you can verify it is an App Store profile as well as the App ID associated to it by using the steps in section How do I confirm my Provisioning Profile is for App Store distribution?
2). verify that your Scheme 'Archive' task is mapped to "Release" using the steps in section:
"Creating an Application Archive"
3). check that you have an your App Store provisioning profile assigned to your "Release" Code Signing Identity using the steps in section
"Assigning Provisioning Profiles to Build Configurations".
Note: it's important to make these changes at the Target level Build Settings, versus the Project level ones, as Target settings override Project ones...you can think of the Project level build settings as 'defaults' to populate target settings (and any future targets) with. Also, Ensure the "All" button is depressed in the upper-left corner of Target Build Settings to reveal the "Code Signing Identity" section.
4). retry your Product > Archive.
If the issue persists after the above, I recommend continuing onto Apple's complete list of potential causes of this error at the following URL "How do I resolve the error: Application failed codesign verification?"
My problem was solved when I noticed that I only had a "team" provisioning profile, and the details in iOS Dev Center told me that it was not a profile fit for development because it had no device attached. So I created a second provisioning profile, which let me check the box for my device so that it had a device attached.
Then when validating or submitting the app from the Organizer window (after pressing 'Build and archive'), I first made the mistake of selecting this new profile as the code signing profile. That was wrong. The profile that worked was iPhone Developer.
Good luck!
PS: This whole submission process is a heap of abacadabra. Do you really have to create a zillion distribution profiles, provisioning profiles, etc.? It hasn't encouraged me in any way to better test my app. I already did that before I chose to upload, and clicking a hundred buttons labeled 'Create','Download' and 'Submit' isn't really a quality control process that added anything (well except being forced to buy an iPad and test on that). Who ever said iOS was developer friendly?
My problem was that the Archive scheme did not have Build Configuration of App Store, but of Release. To change this, go to Product -> Edit scheme, select Archive on left side and change Build Configuration to App Store. I am assuming the code signing is configured properly (with distribution certificate).
You probably created a new certificate without refreshing the provisioning profiles
Create your iOS Distribution Provisioning Profile for App Store Distribution
I solved this by deleting the Archive that's not validating from the Organizer, closed and reopened Xcode and built for Archiving again.
I then chose Archive from the drop down menu. After doing that my app passed validation.
Hope that helps.

iPhone CodeSign failed

So - I am a registered iPhone developer (Having paid my $99/year). I have followed all the steps provided by Apple to get the provisioning and code-signing files. However, when I click 'build', it says:
"Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)"
I have re-downloaded all of the certificates and profiles repeatedly, and it still won't work. However, if I click 'build' (and it says codesign failed), but then drag the product .app file to my device in the organizer or click "Run", it will run on my device. Any suggestions?
Since you are able to run the .app on your device, your problem might be that you have buildt it with your developer provision profile. That won't work. You need to build it with a distribution provisioning profile for App store.
Apple provides good information of how to do this, but I think the info is kind of hidden in all this itunesconnect/provisioning portal stuff... Check this link: http://developer.apple.com/iphone/manage/distribution/index.action . There you sould see two important points:
"Create and download your iPhone Distribution Provisioning Profile for App Store Distribution"
"Building your Application with Xcode for Distribution"
Good luck :-)
Does your profile show up in Xcode's Organizer window? (If not, drag the files from Finder to Xcode.)
What profile is selected in your Xcode project settings? Are you building debug, release, or for distribution?
There are many possible causes of the -19011 code verification error (as evidenced by the dozens of near identical stackoverflow questions about it). The specific cause is hinted at in the detail of the message (see Apple Technical note TN2250 advice on the -19011 issue for details)
In my case the error detail contained the phrase "Failed to load provision profile from:" after which I discovered that having spaces or special characters in the app OR the xcode scheme name can cause codesign verification fail.