Xcode 6 enterprise distribution not working - ios

I am using my company provided enterprise distribution profile (I donot have the userid/password to create the distribution profile) to distribute application. Recently I have upgraded from xcode 5.1 to 6. Since then I am unable to export ipa file. When I chose "Save for Enterprise Distribution" > Next it gives error "You need to add an Apple ID account that is enrolled in the iOS developer program". But earlier I used the same process to export application and used to show a window with company provided distribution profile name. Though it deploy application to my iPhone 5s. I have checked `/Library/MobileDevices/Distribution Profile has the provision profile.
Please let me know what am I missing or I have to do to export for enterprise distribution of apps.

I got the same issue and found this article which helped me a lot about creating an IPA from command line : http://www.thecave.com/2014/09/16/using-xcodebuild-to-export-a-ipa-from-an-archive/
Since you already have your xcarchive created, only the last part is important :
xcodebuild -exportArchive -archivePath $projectname.xcarchive -exportPath $projectname -exportFormat ipa -exportProvisioningProfile “Provisioning Profile Name”
As mentioned in the article, the “Provisioning Profile Name” parameter is neither the name of the provisioning file nor the UDID, but the name of the provisioning as created in the iOS Dev Center. You can get it from Xcode (it's the name of the profile you used to compile) or using the iPhone Configuration Utility App http://support.apple.com/kb/DL1465

I just hit this same problem. It appears that xcode 6 has added an arbirary restriction on exporting ipas with provisioning profiles that you aren't a team member of. You can get around it by manually exporting and signing using the cli.
http://www.thecave.com/2014/09/16/using-xcodebuild-to-export-a-ipa-from-an-archive/

With the new Xcode 6 we need to log-in using a apple id which is signed in apple developer program or is a member of the apple developer program. Without developer account id we cannot built ipa with new Xcode. I was able to build the app after log-in to the app id.

Related

XCode 6 and Ad-Hoc distribution without XC: provisioning

Yesterday I've downloaded Xcode 6 and now I have got a problem I can't solve. In my member center I've got valid certificate and ad-hoc provisioning (distribution). Till yesterday, in Xcode 5 if I wanted to add my .ipa to TestFlight I was using Archive and selecting my valid ad-hoc profile. I wasn't even logged in in my developer account in Xcode.
Now - in Xcode 6 - nothing is working at all. Ok, I've logged in preferences, Xcode downloaded all my provisionings on Mac, but whenever I choose Export it says that I don't have matching provisioning profile and it's creating new provisioning profile with XC: prefix - which I don't want to use, because it contains all devices I have in member center - even those I don't want to include in my app!
I was trying everything from this threads:
Xcode 6 - How to pick signing certificate/provisioning profile for Ad-Hoc distribution?
Xcode 6 GM creating archive
but nothing is working for me. Maybe I don't understand correctly how it works and there is a trick I have to do but I would like to use provisioning profile defined by me. I was trying to create new provisioning profile, rename the old one, remove all from Mac, drag provisioing profile from desktop to Xcode icon, select correct Provisioning Profile in Build Setting all over again but I'm stuck.
Screenshots here:
My Ad-hoc profile is distribution profile.
There is no way to get Xcode 6.x to use an ad-hoc profile that doesn't contain all of the devices on your team; this is by design.
I have a workaround for this that works for me.
I have both Xcode 6 and Xcode 5.1.1 installed, Xcode 6 is in Applications and Xcode 5.1.1 is in another directory. When I want to do a build I use Xcode 6 to create the Archive. But you can also see the created Archive in Xcode 5.1.1 so I use Xcode 5.1.1 to distribute the Ad Hoc .ipa using the provisioning profile that I want to use. So build using Xcode 6 but distribute using Xcode 5.1.1. It works for me.
Xcode6 will now always create a new AdHoc provisioning profile prefixed with 'XC' when you export an archive for testing (e.g. Hockey App). In order to do this you must always have the latest App Store Distribution certificate and private key in your keychain.
NOTE: You do not have to have this latest distribution certificate selected in your provisioning profile you built the archive with. Also keep in mind you do not need to have an AdHoc provisioning profile to export an AdHoc ipa.
When you export the first time you will probably receive an error saying that you do not have an AdHoc provisioning profile with the following devices/people in it. Just hit 'Try Again' and it will work.
Something else to keep in mind is that when exporting an ipa you are forced to test push notifications through their distribution/production servers as it is using the new self generated 'Distribution XC: AdHoc' provisioning profile.
If you are using Urban Airship like we are you can no longer use development keys for testing. If you look under 'Entitlements' once you get through the steps to export it will show you that 'aps-environment' is set to 'production'. If anyone finds an alternate solution for this let me know.
I was facing similar issue with my distribution license, and the problem was there was "XC" provisioning profile which had the exact same bundle id.
My solution to his was to delete this XC: provisioning profile both from Apple Developer Portal and Xcode -> Preferences -> Apple ID -> View Details -> XC: provisioning profile -> right click Go To Finder -> delete
Hope this helps,
I encountered the same issue. On one of the StackOverflow threads you linked to, a solution was recently added that worked for me.
After you have created the archive, you can export it with a specific provisioning profile from the command line:
xcodebuild -exportArchive -archivePath "~/Library/Developer/Xcode/Archives/{some-date}/{appname date, time.xcarchive" -exportPath {appname} -exportFormat ipa -exportProvisioningProfile "{provisioning profile name}"
Note that the provisioning profile name is just the name, without any path or file extension.
I ran into this today as well.
I ended up removing the XC profile from the developer portal and recreating my other ad-hoc and app store profiles and downloading them again.
After I did this, when I built and tried to submit to app store, the correct App Store profile showed up AND when I went to export for ad-hoc, the correct ad-hoc profile showed up.
Yay ;)
I hit a similar problem and discovered that even if you specify the correct profiles in Xcode the Xcode6 system wants you to have the latest (from member centre) provisioning profile (for each team your account is against). It seems to walk each one in turn before using the one you need and gets blocked if you are absent any provisioning profile for the teams you belong to.
I ran into this.
No solution here worked.
I ended up moving to a command line build using nomad cli shenzen. Its another great open source project by mattt
Now I go into a shell and just type:
ipa build
DONE
They even have options to send the ipa to whatever Ad Hoc service you want. Awesome.
In Xcode 6 (at least 6.1 I am using now)when you are doing the export for ad hoc, xcode 6 will automatically scan if there is any provisioning profile contains all devices registered in the developer account and at the same time match the bundle ID. If no, it will use XC provision profile. Therefore, if you want to use your own profile, for example, for the purpose of push notification, you will need to select all devices in your profile on apple developer portal. I guess that's the reason why some people recreate profile would work and some wouldn't.
My way is much simpler:
I go to the developer - provisioning profiles and re-create my Ad Hoc profile by choosing 'Edit' then 'Generate', download it and install with double-click. When exporting .ipa the correct (mine) profile is chosen.
Apple only uses the last built provisioning profile, obviously.

Xcode attempted to locate or generate matching signing assets and failed to do so

So I'm trying to create an ad-hoc build using existing provisioning profile (that worked before) with Xcode 6.0.1 on Mavericks, but after trying to export this archive, I keep getting the following error:
Do I need to re-create my certificates and provisioning profiles, or is there a better solution? Thanks!
I'm also facing this issue as a 'Team Member' role. The 'You are not allowed to perform this operation' warning leads me to believe that XCode is more strictly enforcing the roles defined here: https://developer.apple.com/programs/roles/
Even though I have access to the signing assets (certificate and provisioning profile), XCode won't allow me to specify them. Try upgrading your role to Team Admin.
Updated 2014-09-29:
After extensive research, I've found it is possible to generate the .ipa using xcodebuild from the command line even as a 'Team Member' role using the following:
xcodebuild -exportArchive -archivePath $projectname.xcarchive -exportPath $projectname -exportFormat ipa -exportProvisioningProfile "Provisioning Profile Name"
credit to 1
Note: As pointed out in the linked article, the "Provisioning Profile Name" is the name specified in the name field of the certificate (viewable from developer.apple.com).
You can automate the process in xcode by including the call into your project build script.
Try to open your console and go to your Xcode project folder then type these commands:
to clean your project
xcodebuild clean -project YourProjectName.xcodeproj -configuration Release -alltargets
to build and archive your app
xcodebuild archive -project YourProjectName.xcodeproj -scheme YourSchemaName -archivePath YourProjectName.xcarchive
You can simply find YourSchemaName in
Xcode > Product > Scheme > Edit Scheme...
finally to create your app .ipa file
xcodebuild -exportArchive -archivePath YourProjectName.xcarchive -exportPath YourProjectName -exportFormat ipa -exportProvisioningProfile 'Your Provisioning Profile Name'
To find Your Provisioning Profile Name please login to Apple Developer Member Center and go to Certificates, Identifiers & Profiles, then click on Provisioning Profiles for iOS Apps. There you will find Your Provisioning Profile Name.
If it does not work try to replace single quote with double one ( ' with " ).
You will find .ipa file in your Xcode project folder.
After this you will able to open your .ipa file in iTunes and install on your iOS device.
I hope it helps!
What's happening: Xcode need to sign build with valid Certificate. It is trying to locate one with no luck. Why? Because before Xcode6, you were allowed to sign AdHoc builds with your's developer certificate. And you were able to, because you have a private key for it. But now you need to sign Ad Hoc builds with Production Certificate. And you don't have a private key for it.
So steps required to make it possible to build from Xcode6 (https://stackoverflow.com/a/26061067/1918302):
Get a private key for your Production Certificate. (You need to export it from Mac keychain it has and import to your's keychain OR Revoke current and Create New production certificate. During creation you'll get one. Quoting here from link above:
BEWARE: revoking an enterprise distribution certificate invalidates all apps that were signed and deployed with that
certificate (official info)).
Create special XC Ad Hoc: Distribution provisioning profile (if you have Admin role in your team on developer.apple.com - Xcode will do this for you).
Set provisioning profile in your project's target -> Build Settings -> Code Signing to this created in step 2.
Done!
OR if those above not achievable, you can make a build using command line tools: https://stackoverflow.com/a/25979784/1918302.
But this seems to me as security hole and I don't believe that this will work for long time.
We were able to work around this problem by simply having one of the admins download the "XC Ad Hoc: Distribution" profile from the dev center, then sending it to the "Team Member" who wanted to build, and letting him manually import it. Since he already had the cert, this was all he needed to be able to do the build and stop getting this error. Existing answers here are correct, but this is a low-friction way to get the last piece of the puzzle for many of us.
In summary, you need this profile and the cert with a private key in your keychain.
For me, it turned out the cause of this was I had not set the project's provisioning profile property as per this answer.
I my case, the problem was App ID. Of course the app did exist in my member center account. The problem was in Capabilities pane. Some of the capabilities had not resolved issue, but the build was succesed. This lead to the situation, when my App ID in member center and Xcode have different capabilities settings.
Removing this dissonance have resolved my problem.
Check it twice, if you have simular issue.
You must define your account in Xcode->preferences->account
It seems that you have define an appleId which is not allowed to access IOS developer account.
Try to sign with that user in https://developer.apple.com/devcenter/ios/index.action and see if that user is allowed in an IOS developer program.
This can happens if you have signed with an iTunes connect. They are different accounts.
I hope this helps!
Your distributed account is not match team .
You must define your account in xcodeproj->Identity->Team ->Add an Account
I was also receiving this error because the Developer Certificate for the machine I was building on had expired.
Even after renewing that certificate, I was unable to Export the Build for App Store release.
Even after following the instructions in the accepted answer and upgrading that Developer account to an admin.
It turns out, that because the Archive was created while that Developer Certificate was expired, that Developer was unable to codesign using the Distribution Profile.
I had to recreate the Archive, after renewing the Developer Certificate, for that machine to be allowed to use the Distribution Certificate (already installed and previously working) to be allowed to codesign the new archive and upload to app store.
Sharing in case anyone else hits this edge case.

Using xcode 6 beta 6 we are unable to Create an ipa file [duplicate]

I'm having trouble exporting an app for Ad Hoc Distribution on Xcode 6 beta 2:
When exporting my project for ad hoc development on Xcode 6, I receive this alert. I've tried exporting it on Xcode 5 and had no problems at all saving the .ipa. Is anyone experiencing this problem as well?
I've had the same issue two days ago. Turns out the problem was:
I have my own developer distribution certificate with a proper private key
I have enterprise developer distribution certificate of my client without a private key
I try to make an enterprise distribution package for my client
Xcode throws at me vague error: Your account already has a valid iOS distribution certificate
The solution is: get a private key for enterprise account of my client. There are 2 possible options:
Ask you client for credentials to access his enterprise developer account on Apple website. Revoke old certificate and recreate it. You'll create the private key in the process. BEWARE: revoking an enterprise distribution certificate invalidates all apps that were signed and deployed with that certificate (official info).
Ask your client to export his private key from his Keychain Access application as a *.p12 file and send it to you with a password. You can't download the existing private key from the Apple website. The only way to get it is to ask your client. I did it and it and I was able to finally make the package.
How to find out if you have a private key for a certificate: Open Keychain Access application. Choose certificates. Find your certificate. If you see small grey triangle on the left side of the certificate, open it and you see your private key. No triangle = no private key.
This is what worked for me.
On my machine I kept both Xcode 5 and Xcode 6 beta.
From Xcode 6 beta, Archive the project. Close Xcode 6.
Open Xcode 5, go to Organizer and export as Ad Hoc build with proper provisioning profile.
That's it!
I had the same problem, I had to use the command line "xcodebuild" tool as a workaround, with only Xcode 6 installed (didn't have to re-install Xcode 5).
http://www.thecave.com/2014/09/16/using-xcodebuild-to-export-a-ipa-from-an-archive/
Example:
xcodebuild -exportArchive -archivePath $projectname.xcarchive -exportPath $projectname -exportFormat ipa -exportProvisioningProfile "Provisioning Profile Name"
In my case, what solved the problem was deleting all Distribution Certificates from my Apple Developer Account. Then, Xcode managed to create development and distribution certificates again, and that did the trick.
I get a solution without renew the certificate:
1 - Archive the target with the appropiate Code Signing Identity and Provisioning Profile
2 - Right button in the created file in Organizer --> Show in Finder
3 - Right button in the xcarchive file --> Show package content
4 - There, in Finder, go to Products/Applications/
5 - Upload the file Products/Applications/appName to iTunes
6 - When the app appear in iTunes, right click on it --> Show in Finder. This is the ipa file
7 - Send this ipa through App Loader 3.0
I dont think that it is a lasting solution but do not want to delete my certificates
FINALLY SOLVED IT!!
1) Create a NEW production certificate through developer.apple.com which requires you to use Keychain Access to create a new private key on your computer
2) In the same developer portal, open your distribution Provisioning Profile used with this app and select the new production certificate which you just created. Generate the provision then download it and run it
3) Run your app, Archive it, then export the archive.
viola
This took me days if not weeks to figure out, I hope it helps you.
Create new iOS Distributon Certificate and choose Production> App Store & AdHoc section. Also don't forget to change Target>Build Settings> Code Signing all to iOS Distribution.(but after created ipa set it back to iOS Developer)
Only this solved my problem.
I faced the same issue today with Xcode 6.1.1
When I tried to add iOS Distribution certificate via Xcode the error I got was the same. There were already several issued distribution certificates in Member Center and I did not want to invalidate them because if they are used for Ad Hoc distribution in an Enterprise environment this would also invalidate the applications that are installed on the devices (at least this is what I've read).
What I did was:
1. Through Keychain Access generated a request for a certificate from a certification authority. And saved the request to a file;
2. Logged in to Member Center certificates area Production section and requested a new "App Store and Ad Hoc" production certificate, this requested the file from step 1;
3. Downloaded the new certificate and when imported in Keychain Access it now had a private key.
Afterwords I cleaned Xcode, restarted it, checked that in my account the profile is visible and built a new Archive. And now I was able to validate the archive.
Now if I try to request a new "App Store and Ad Hoc" certificate this option is grayed out for me and I suppose this is because my account already has the certificate issued. If this is your case you will most probably need to invalidate your previous certificate before you can issue a new one. This is why Apple recommend backing up your certificate. But it is very likely that you will not need to invalidate all production certificates as I already have a number of those in the profile.
Hope this helps someone :)
Apple has changed the way of Ad Hoc build. Now you can't make Ad Hoc distribution builds using dev cert. You should use a distribution cert with an "Ad Hoc" provisioning profile instead.
I believe the actual reason you ended up in this screen is while trying to get the .ipa file to be distributed to your testers and clients.
In Xcode 6, to get the .ipa file you may use the old method for iPA generation:
Select organiser in Xcode. In the Archives tab select the Archive whose iPA file you need to generate.
Right click and select option “Show in Finder”
You will see the .xarchive file. Right click and select “Show Package Contents”
You will see folders: dSYMs, Info.plist and Products.
Open Products>Applications and you will see your .app file.
Drag and drop this .app file to iTunes in Mac.
Your .app file will be listed under "My Apps" in iTunes.
Right click on your application and select “Show in Finder”.
Now you have the .ipa file which you can send to your testers for testing.
Hope this helps.
There has been changes in way apple manages our private and public key.
The previous method to share account on two machine was
1.download provisioning
2.export/checkout certificate
install them both on the other mac
but now you dont have to do that you export your entire account.
1.XCode -> preferences -> account (select account) on bottom left there is option to export that
you will be prompted to give a password give any it will be required while importing on other system.A .developerprofile file will be downloaded on location of your choice.
2.download it on other mac and when you see the prompt your device already have valid signing identity click on import Developer Profile and import this .developerprofile file. enter password when prompted.
got help from here
I resolved it following the next steps:
1)in your apple developer account: Create a new Production Certificate Choose the App Store and Ad Hoc Option
2)in your apple developer account: Create a new provisioning profile with you current bundle id and the certificate created in the step one
3)in your xcode:
Select your target
In the tab Build Settings in the zone Code Signing
In the sub-zone Code Signing Identity - Release
Set your new distribution certificate (ad hoc)
In the Provisioning Profile - set your new provisioning profile (ad hoc)
Seems that xcode 6 now requires an ad hoc distribution certificate in order to export your IPA.
I got the same issue today, and found a good solution I think.
First of all, there're something unnormal:
the normal is:
and in the keychain:
the normal is:
then, I realize that I lack the the correct provisioning profile which contains the correct iOS Distribution certificate.
Finally, my solution is: use my CertificateSigningRequest.certSigningRequest file to generate a new iOS distribution certificate, and use the new iOS distribution certificate to generate a new provisioning profile.
Note, I don't delete the old certification and provisioning profile, because my colleague works well with them. Does this affect the apps I already published? The answer is NO. I just change the code signing certificate, and some important certificate like push notification certificate is ties with app ID:
So don't worry about that.
Hope the above is helpful.
As pointed out by a commenter this has proven to be a solution for myself and others:
I deleted and re-downloaded all my required certificates along with the keys needed to generate and i was able to get past this error
I revoke my producion certificates, and request another one, solve this problem.
Maybe you need restart your xcode.
I just encountered this after upgrading from Xcode 5 to 6.
In my case creating a new production certificate and then recreating the distribution provisioning profile for my app did the trick.
In the official latest Xcode 6.0, this will happen if you accidentally created a record in your entitlements file that has a key like this:
com.apple.security.application-groups
I am not sure if Xcode automatically created it by default. But deleting that key solved my problem. I didn't have to recreate any certificates. It was not my problem.
I solved this by simply regenerating the provisioning profile on the developer portal (in my case an App Store profile) and adding to my computer via iPhone Configuration Utility. I didn't want to mess with the certificates and successfully avoided that.
I noticed this error message logged from Xcode in my console:
None of the valid provisioning profiles allowed the specified entitlements: application-identifier, beta-reports-active, keychain-access-groups.
After downloading a the new provisioning profile, the missing beta-reports-active = true was present and Xcode signed the build.
My Solution was Delete the only iOS Production Certificate which I'm using and create it again. Doing this, you must create a new Provisioning profile assigning the certificate just created.
then I did the process of Archive again and works!
Additionally I found that Xcode Accounts come into play -
It turned out that I did have a valid distribution certificate on my personal account (mobilology) so I deleted that account temporarily from the Accounts section (you may wish to leave only that account that you are distributing from).
Suddenly the signing / archiving process worked!
Step1:-Login to your apple developer account
Step2:-Choose Certificates
Step3:-Delete if there are more than one distribution certificates
Step4:-Then retry archiving ( if error still exist, revoke all certificates and create new distribution certificate and edit your provision profiles.)
I think its a bug from Xcode. to make it work, i need delete the actual distribution provisional profile and i had to make a new provisional distribution profile from devcenter. This works from me
I also faced the same problem, i was using development certificate instead of Adhoc. Issue is fixed after using Adhoc certificate.
Delete you ios Distribution certificate from the apple developer site and regenrate the ios Distribution with the certSignReq file. Works for me always. Your other apps wouldnt be affected . Atleast in my case it never did.
In my case I generated a new distribution profile and added it to XCode, then tried to submit the build. Turns out, all I had to do to get rid of this message is restart XCode and attempt again to submit. Worked.
In my case, I got the error message when trying to export and AdHoc build from Organizer. I did two things, either of which may have fixed the issue:
1) Exported the existing certificate it claimed I did not have from my keychain, deleted it from keychain, re-imported.
2) Created an ad-hoc distribution certificate, refreshed XCode account to obtain the new distribution provisioning profile.
After that I was able to export the exact same archive to an AdHoc build. I really think it was only that fact I was missing an ad-hoc distribution that targeted that specifc bundleID that led to XCode being confused.
Followup: The archive I had created before did not work, I had to re-generate it. A clue this was an issue was that when selecting the archive and opting to export an Ad-Hoc build, the default account selected was the wrong account for the build (the project had no default account selected when I archived the build).
This is what worked for me (Enterprise Account)
Import the developer profile from the other machine, which loaded the certificate I needed with the secret key.
Rename the app bundle to the enterprise name (it was named under the app store name).
Change the team name in the "General" tab to my company's team - it was defaulting to my personal developer account!
With these changes, I could export an ipa as both ad-hoc and enterprise, upload it to Hockey Rink, and download it on my phone

Xcode 6 - How to pick signing certificate/provisioning profile for Ad-Hoc distribution?

To distribute the app to our testers we use Xcode, which we do using the following process:
Archive application
Distribute for Ad-Hoc
Choose provisioning profile
Save the .ipa to a folder
But with Xcode 6, this workflow was changed a bit. I can still select the Ad-Hoc distribution option, but I cannot select the provisioning profile I want. This gives us no control over which signing certificate is used and the provisioning profile configuration (we use push notifications).
By default iPhone distribution signing identity is used and some kind of XC Ad Hoc provisioning profile is generated, which can be seen on image below:
If you click the arrow near provisioning profile, it opens the folder with provisioning profiles.
So my question is:
Is there any way in Xcode 6 to select the provisioning profile used with Ad Hoc distribution?
Thanks!
I was facing same issue, resolved using command line "xcodebuild" tool script, which is preinstalled with Xcode 6 (didn't need to re-install Xcode 5).
http://www.thecave.com/2014/09/16/using-xcodebuild-to-export-a-ipa-from-an-archive/
Script in terminal:
xcodebuild -exportArchive -archivePath $projectname.xcarchive -exportPath $projectname -exportFormat ipa -exportProvisioningProfile 'Provisioning Profile Name'
I had a similar issue when submitting to The App Store. I created an archive, then clicked "submit" and Xcode wanted to automatically sign with the default "XC com.*" wildcard provisioning profile instead of the explicit profile that already had.
To fix this, I just re-generated the profile on the Apple Developer Portal:
1) Go to developer.apple.com and find the distribution provisioning profile you want to use.
2) Select it, click "Edit", re-name the profile, and click "Generate".
3) Download the provisioning profile to the Desktop and drag it onto the Xcode 6 icon.
4) Re-start Xcode 6.
5) Open the organizer window and click "Submit" on the archive you built. Xcode will automatically pick your explicit profile instead of the generic one.
Once you are in Organizer
Select the ad-hoc build and click "Export...."
Select "Save for Ad Hoc Deployment" -> Next
Instead of selecting an organisation from the drop down select "Use local signing asset" -> Choose
Export and save .ipa as before.
Of course you need to have generated, downloaded and installed the ad-hoc provisioning profile.
It seems the last generated provisioning profile wins right now. So you can just re-generate the profile you want and download it and Xcode will use it.
A slightly better approach: set the desired prov profile in your target and use the command line to build your ipa, that works, too.
Here is the script, I'm using:
#!/bin/sh
# Current as working as of 2014/09/22
# Xcode 6
OUTPUTDIR="$HOME/build"
APPNAME="your-app"
SCHEME="your-app"
APP_WORKSPACE="$HOME/Path/To/your-app.xcworkspace"
rm "$OUTPUTDIR/$APPNAME.ipa" #deletes previous ipa
xcodebuild -workspace "$APP_WORKSPACE" -scheme "$SCHEME" archive -archivePath "$OUTPUTDIR/$APPNAME.xcarchive"
xcodebuild -exportArchive -exportFormat ipa -archivePath "$OUTPUTDIR/$APPNAME.xcarchive" -exportPath "$OUTPUTDIR/$APPNAME.ipa"
and my settings:
I couldn't figure this out either - got bit by it when submitting to the AppStore, where it defaulted to a wildcard profile.
I ended up building in Xcode 6, then going back to Xcode 5's Organizer window for the submission. That way it'll prompt you to pick a profile to sign with.
In Xcode 6 (at least 6.1 I am using now)when you are doing the export for ad hoc, xcode 6 will automatically scan if there is any provisioning profile contains all devices registered in the developer account and at the same time match the bundle ID. If no, it will use XC provision profile. Therefore, if you want to use your own profile, for example, for the purpose of push notification, you will need to select all devices in your profile on apple developer portal. I guess that's the reason why some people recreate profile would work and some wouldn't.
btw,use script can export and upload to testflight, but device just can't download it. probably somewhere I got wrong. if anyone knows why it is, pls let me know. tks
This worked for me:
click "View Accounts.." within the "..select a Development Team.."
dialog.
click "View Details.." and find the XC Ad Hoc provisioning profile.
right click on that profile and chose "Show in Finder".
delete the selected profile.
go back to the dialog in step 1.
click "Chose".
click the arrow near provisioning profile to open the provisioning
profiles directory.
delete again the generic profile like in step 4.
click "Previous" button from the "Send [application name] to Apple:" dialog.
select again "Save for Ad Hoc Deployment"
click again the "choose" button.
now you should see the right provisioning profile name.
I have a workaround for this that works for me.
I have both Xcode 6 and Xcode 5.1.1 installed, Xcode 6 is in Applications and Xcode 5.1.1 is in another directory. When I want to do a build I use Xcode 6 to create the Archive. But you can also see the created Archive in Xcode 5.1.1 so I use Xcode 5.1.1 to distribute the Ad Hoc .ipa using the provisioning profile that I want to use. So build using Xcode 6 but distribute using Xcode 5.1.1.
Using local signing assets while exporting solved the issue for me:
The answer from #MrPatol did not work for me.
My working scenario for Xcode 6.3.2
In Member Centre -> iOS Provisioning Profiles
Delete provisioning profile which was set by default when you were trying to build the app (e.g. "XC..."). Create an ad-hoc provisioning profile (not production) with a short name.
In iPhone Configuration Utility -> Provisioning Profiles
Delete the same provisioning profile (e.g. "XC...")
In Xcode -> Organizer
Select the ad-hoc build and click "Export...."
Select "Save for Ad Hoc Deployment" -> Next
Select an organisation from the drop down
Check that your new ad-hoc provisioning profile is selected automatically
Export and save .ipa as before.
Here are the two key points that solved the problem for me.
When you generate the provisioning profile, it needs to be linked to an Explicit App ID that uses the same bundle identifier as your app. A wildcard App ID will not work.
When you export the app for ad-hoc deployment, select Use local signing asset in the dropdown and click Choose.
Xcode will then find the correct provisioning profile by matching up the App ID with the bundle identifier of the app.
In fact, you need to create a new Distribution profile, specific for Ad Hoc Deployment. This can be found in the classic member center, but it is a new type of certificate.
You can then select which devices can be used to test the app as ou would do with a developer profile.
And the newly created certificate will be available when you export your package from the Organizer the usual way.
Alternatively you can use the TestFlight solution provided by Apple with iOS 8 to enable your user to have access to prerelease.
I had the same problem, finally I solved it regenerating the profile that I wanted to use in Xcode 6 including all the devices that I have registered on my iOS Dev account, doing it that way, when selecting export it shows the correct profile and I can do the Ad Hoc export with Xcode 6 without using a script. Hope it helps.
I've been stuck for a while with this ,, but using Crashlytics solved it , build distributed using the selected profile in the build settings of your Xcode project .
hope it helps somebody .
Almost the same problem. After creating an archive for distribution (Product > Archive) you export the archive (click Export...) and choose "Save for Enterprise Deployment"; then "Next". You then select the "Development Team" default (e.g. organisation name) and click "Choose". Finally you will be presented with a summary view that also lists the provisioning profile that Xcode automatically has found (maybe created on-the-fly) for you. This MIGHT be the wrong provisioning profile (typically a wildcard provisioning profile, like "XC: *") and MIGHT be happening because there already is a wildcard provisioning profile on the developer portal. The wildcard provisioning profile MIGHT be used by other older project and maybe it is not wise to just remove the wildcard provisioning profile from the developer portal.
I used a support ticket for this and only got this link back https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringPushNotifications/ConfiguringPushNotifications.html#//apple_ref/doc/uid/TP40012582-CH32-SW1. Not really a big help.
I have found that MrPatol's solution also works for Enterprise Deployment as well and solves the problem for us. I first logged into the developer portal and manually create a provisioning profile that suited my app. Then downloaded and installed the new manually created provisioning profile.
In xcode 7, I couldn't be able to pick adhoc provisioning via
Organizer -> Upload to App Store & Organizer -> Validate
But I could choose via Organizer -> Export
Edited:
Uploading the app after exporting for adhoc to app store for testFlight caused another issue discussed here. So, solution to both these problem is one. Create AppStore provisioning to be able to pick it via organizer and utilize testFlight by uploading to appstore.
I think it's a right way to specify a -exportOptionsPlist option after Xcode 7. It will choose the right provision files like in the GUI export no matter what you specify in project setting.
xcodebuild -exportArchive -archivePath $Archive_Path -exportPath
$LOCAL_PACKAGE_DIR -exportOptionsPlist $Export_Plist_Path
optionPlist file is like this,
<dict>
<key>teamID</key>
<string>MYTEAMID123</string>
<key> teamID </key>
<string>app-store</string>
<key>uploadSymbols</key>
<true/>
</dict>
<plist>
app-store, enterprise, ad-hoc, development are alternative
But you may meet another error after above.
Error Domain=IDEDistributionErrorDomain Code=14 "No applicable
devices found." UserInfo={NSLocalizedDescription=No applicable devices
found.}
It's a ruby problem. Try this shell script, xcbuild-safe.sh
xcbuild-safe.sh xxxxNormalOptionsInXcodebuild bla...
Wait for a moment, another strange error comes.
xcbuild-safe.sh: line 62: shell_session_update: command not found
What's the hell shell_session_update ? Let us work around it. Just define a function before the real xcodebuild cmd, namely at the line 60 or 61.
function shell_session_update() { :; }
In answer to your specific question, no there is no way to select the provisioning profile to be used. What are you attempting to do? (i.e. what does the profile that you want to select allow that the automatically generated one doesn't?)

How can I deliver an iOS app IPA to a customer to be signed with their own Enterprise provisioning profile

We have developed an iOS app that has been delivered to the customer as an IPA with an ad-hoc distribution profile that allowed a set of their employees to install it on their devices. The customer now wishes to distribute that app internally to all their employees using their iOS Enterprise Developer program credentials.
I had hoped that the customer could simply re-codesign the ad-hoc IPA with their own enterprise identity. However, they say they can't do that. They say they "need an IPA file with the removal of the limitation to only certain devices".
So, what do I do?
Do I need to somehow create an "unsigned" IPA for them? (And if so, how do I do that?)
Do I need them to generate an Enterprise distribution provisioning profile for me so I can build the app with that profile?
Do I need to just send them the source or build output and let them build the package?
I have looked at the following documents, but they have not enlightened me:
TN2250: iOS code Signing Setup, Process, and Troubleshooting
Distributing Enterprise Apps for iOS Devices
It's completely possible to take any IPA and resign it with your own details, modifying the Info.plist, bundle ID, etc. in the process. I do this all the time with IPAs that have been signed by other developers using their own provisioning profiles and signing identities.
If they aren't familiar with the codesign command line tool and all the details of replacing embedded.mobileprovision files and entitlements, the easiest way for them to do this is for you to "Archive" the app via Xcode, and send them the generated archive file (*.xcarchive).
They can import that into Xcode so it is visible in the Organizer, and from there they can choose "Distribute" and sign it with their enterprise identity.
To import the .xcarchive file into Xcode, they just need to copy the file into the ~/Library/Developer/Xcode/Archives directory and it should appear in the Xcode organizer. Then they click "Distribute" and follow the instructions:

Resources