Can't create xcarchive to ipa with Xcode 9 - ios

I am trying to convert my xcarchive to ipa. I tried using this advice with no success: How to convert .xcarchive to .ipa for client to submit app to app store using Application Loader
I am an absolute beginner to Mac and Apple Profiles and certificates.
All I know is:
I have the iOS distribution certificate
I have Production Provision profile
I just hired a Mac in Cloud to convert it to IPA and upload to the app store.
I am using this type of command:
xcodebuild
-exportArchive
-exportOptionsPlist {PATH_TO_PROJECT_ROOT}/ios/build/info.plist
-archivePath {PATH_TO_ARCHIVE_MADE_USING_XCODE}/MyApp.xcarchive
-exportPath {PATH_TO_EXPORT_THE_APP}/MyApp.ipa
with this info.plist code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>provisioningProfiles</key>
<dict>
<key>UUID</key>
<string>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>teamID</key>
<string>XXXXXXXX</string>
</dict>
</plist>
And I am getting an error: no matching certificate "iPhone Distribution: ..." for teamID: ....
What am I doing wrong?
What is the exact value I must input in this?
<key>signingCertificate</key>
<string>iPhone Distribution</string>
Also, am I supposed to install any certificates or something like that on the Mac? I have never used Mac or Xcode before; I am just following the tips for generating ipa with command line code.

The certificate has to be installed in the keychain to identify this Mac as the one that can build for distribution. I don't know whether you'll be able to do that with a virtual cloud based “machine”, but in any case your phrase "I have iOS distribution certificate" is evidently mistaken, because the sense in which you need to "have" the certificate in order to distribute is "have it installed in the keychain". If you look in the Manage Certificates dialog of the Xcode Accounts preference pane, it will tell you clearly the status of your certificates.

Related

Ipa - entitlistments problems

We have received a Ipa file from a developer, and want to resign it with our own distribution certificate.
That part is quite easy from the terminal.
I tried to install the app afterwards through apple configurator 2, but can see on the device log that "the executable was signed with invalid entitlements"
If I check the mobile provisioning I can see it has been certified with my company ID that I did. But checking the app entitlements, it still stand with the external companies info
Anyone have a clue how to change this
Add --entitlements to your re-sign ipa command to sign with entitlements.
codesign -f -s "iPhone Distribution: Developer (ABCDEFGHIJ)" --entitlements entitlements.plist YourApp/YourApp.app
You can find the entitlements from your app and modify it.
...
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>ABCDEFGHIJ.com.yourapp</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
</dict>
</plist>

Resign decrypted ipa with adhoc provisioning profile

I wanted to resign a decrypted ipa with an adhoc profile by me. I changed the bundle id of the decrypted ipa to an own bundle id (com.example.decripa). I registered that bundle id in my developer portal and created an adhoc provisioning profile from that. I downloaded it and used iReSign to resign the decrypted ipa. The parameters in iReSign:
ipa: the decrypted ipa (DecrIpa.ipa)
provisioning profile: the adhoc provisioning profile I created (DecrIpa.mobileprovision)
entitlements.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>developerID.com.example.decripa</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>developerID.com.example.decripa</string>
</array>
</dict>
</plist>
After that I created the other necessary files using BetaBuilder and uploaded them to my website. The process using BetaBuilder worked for other apps (by me) where I could archive them for adhoc use right out of Xcode.
But if I downloaded the manifest.plist the app would install but be greyed out. There was no option to trust the developer in settings.
I only have a normal developer account and not an enterprise account.
How can I resign a decrypted ipa for adhoc use? I have no access to the project, only to the ipa.
Thank you for your help!
PS: All italic written IDs and names are not real, I just used them here to make things easier.
PPS: I added my UDID to the adhoc provisioning profile, as I said, the process already worked for another app (by me) where I could archive it for adhoc use right out of Xcode.
EDIT: Here is the system log: The system log
Use this mac application for resigning your ipa with new certificate and provisioning or different bundle identifier. I have successfully resign on xcode 8.3
Link: https://github.com/DanTheMan827/ios-app-signer

The executable was signed with invalid entitlements (0xE8008016) - tried all other solutions

I know this has been asked a hundred thousand times, but after 3 hours none of the answers have provided any solution to my issue.
I recently changed an app I'm developing from ad-hoc distribution to enterprise distribution. I also updated to Xcode 7.1 this morning (although I'm not sure if it's related). With nothing else changing in my application, whenever I try to compile the application now and install it on my device, I get the error that the Code Signing Entitlements file toes not match the entitlements in the provisioning profile.
My entitlements:
$ cat GoDriver/GoDriver.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.rudylimo.GoDriver</string>
</array>
</dict>
</plist>
The App ID on the developer portal:
And my apps capabilities:
I've attempted to run the app on 2 devices and a simulator and it will only run on the simulator.
EDIT:
After some more testing, if I remove the aps-environment row from my entitlements file, the app builds and installs properly (but without push notifications working).

Xamarin iOS app "does not contain the correct beta entitlement" despite the beta entitlement flag being part of the provisioning profile

As the original TestFlight app will be retired in a month, I am trying to get to grips with the iTunes Connect Beta system, which looks like a significant improvement. As directed, I regenerated my provisioning profiles and redownloaded them on my build server.
I then performed the build with the "AppStore|Release" profile and I saw this message in the log:
codesign -v -f -s "XXXXXX" "--resource-rules=/.../MyApp.app/ResourceRules.plist" --entitlements "/../iSnagMobileiOS.xcent" "/../iSnagMobileiOS.app"
The file specified in the entitlements parameter contained the beta-reports-active key as expected:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>XXXXXXX.com.mycompany.myapp</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXX</string>
<key>beta-reports-active</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>XXXXX.com.mycompany.myapp</string>
</array>
</dict>
</plist>
I then retrieved the generated IPA, which was signed with my distribution certificate. In order to check that the correct entitlement had been applied, I executed this command to check the provisioning profile:
unzip -p MyApp.ipa Payload/MyApp.app/embedded.mobileprovision | security cms -D
Within the XML fragment I could see the entitlements dictionary which contained the flag as expected:
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXX.*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>XXXXXXXX.com.mycompany.myapp</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXXX</string>
<key>beta-reports-active</key>
<true/>
</dict>
There is also no extra Entitlements.plist file in the IPA that might be throwing this off.
I uploaded the IPA with Application Loader 3.0, but I then received this error message:
WARNING: ITMS-90191: "Missing beta entitlement. Your app does not include the beta-reports-active entitlement. If you intend to distribute this build via TestFlight for beta testing, please re-build this app with a newly generated provisioning profile."
I have found numerous hits while searching for this message but none seemed to describe the above the problem; all those users found that regenerating the profile and downloading it again was all that was required.
I wondered if I was perhaps experiencing an issue caused by an older version of XCode or MonoTouch but after I updated both, I still experienced the same problem. I'm going to guess that this issue is not caused by Xamarin but is perhaps caused by a setting I have overlooked in my build configuration, but I could be wrong there.

Enterprise app deployment doesn't install on iOS 8.1.3

After updating iOS 8.1.3, I tried to download, but getting error "Unable to download app" and "could not be installed at this time" messages appears.
What are changes between 8.1.2 and 8.1.3 which i have to take into consideration?
Download mode: < a
href="itms-services://?action=download-manifest&url=https://****.plist">
Thanks!
After a few hours wracking braincells, here's how I did it:
NOTE: I haven't currently tested this against iOS 8.1.2 or lower (proceed with caution!)
For apps that have ALREADY been signed with your OWN enterprise certificate, all you have to do (as mentioned by RAStudios in his edit) is to edit the manifest.plist:
Before:
<key>bundle-identifier</key>
<string>uk.co.acme.AcmeApp</string>
After:
<key>bundle-identifier</key>
<string>S836XXACME.uk.co.acme.AcmeApp</string>
For apps that have been signed by a third party that you're resigning with your enterprise certificate (this walkthrough is assuming the ipa file is AcmeApp.ipa, your entitlements file is entitlements.plist and your provisioning profile is provProvile.mobileprovision; all files are in the Desktop folder (Mac OSX), and S836XXACME is your team identifier):
Create a new entitlements.plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>S836XXACME.uk.co.acme.AcmeApp</string>
<key>get-task-allow</key>
<false/>
</dict>
</plist>
Unzip the ipa:
cd ~/Desktop
unzip AcmeApp.ipa
Remove the Code Signature:
rm -r Payload/AcmeApp.app/_CodeSignature/
Copy in the mobileprovision file:
cp provProfile.mobileprovision Payload/AcmeApp.app/embedded.mobileprovision
Codesign:
codesign -f -s "iPhone Distribution: ACME Corporation Limited" --entitlements entitlements.plist Payload/AcmeApp.app
Zip it up as the resigned ipa:
zip -qr AcmeApp_resigned.ipa Payload/
You also need to amend the manifest.plist file as per the 'ALREADY' signed part earlier:
<key>bundle-identifier</key>
<string>S836XXACME.uk.co.acme.AcmeApp</string>
After investigating..
Edit: After further testing, I found that simply matching the bundle ID in the Info.plist and the bundle ID in the manifest.plist worked for installing apps over-the-air on iOS 8.1.3. If this solution does not work, try the solution below.
Original Solution
Fix to the problem:
Your application must have a valid entitlements.plist, which includes correct the valid bundle identifier of an application.
If you are distributing an application signed with a iOS development certificate, here is an example of a entitlements.plist you should include with your app.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>com.yourbundleidhere.mycoolapp</string>
<key>com.apple.developer.team-identifier</key>
<string>com.yourbundleidhere.mycoolapp</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>com.yourbundleidhere.mycoolapp</string>
</array>
</dict>
</plist>
If you are using a wildcard profile, replace com.yourbundleidhere.mycoolapp with yourwildcardappid.*. In both instances, you can use iResign to properly resign applications and include the now required, entitlements.plist.
Explanation of the problem
Due to security patches (see here under CVE-2014-4493), without the entitlements.plist, the application will not install. The security patch keeps applications from overriding existing apps and installing over the top of them/replacing them.
I've done quite a few experiments with this. In my experience the bundle identifier in the manifest.plist file isn't actually that critical. The most important thing to do is to get the entitlements.plist correct.
Rather than creating this manually I would recommend generating it from the provisioning profile using the following script (credit):
# Create an entitlements file
# parse provision profile
security cms -D -i "provProfile.mobileprovision" > ProvisionProfile.plist 2>&1
# generate entitilements.plist
/usr/libexec/PlistBuddy -x -c "Print Entitlements" ProvisionProfile.plist > Entitlements.plist 2>&1
You can then use this entitlements file with the --entitlements option on the codesign utility.
I have the same issue and this happens for the applications that doesn't have any entitlements.
Re-signing the app with entitlement solved the issue for me, but this is going to be pain as all the applications that are already deployed need to be re-signed and deployed.
This is a weird issue because these apps which failed for me doesn't use anything like keychain sharing or push notifications and hence doesn't need an entitlement at all (as per my understanding). Now when I just add an entitlement with keychain-sharing it starts working.
I have answered this here, this worked for me without having to do anything else
In addition to #Mark's and #RaStudio's answers, I have seen two more causes for the 'Unable to download application' message; one of which is new to iOS 8.1.3.
New failure cause on iOS 8.1.3
This error occurs when trying to install an application that has an expired provisioning profile. When signing an application, both the certificate and the provisioning profile must be valid and not expired. It seems as though an application with an expired provisioning profile and non-expired certificate can be installed on iOS 8.1.2 in some circumstances. Ensure that the provisining profile is not expired by going to Apple's developer center.
Old failure cause
This error occurs when trying to download an application signed with a development certificate and provisioning profile if the device has not been added to the development provisining profile on Apple's developer center.
I have sovled this problem.
Since Apple has changed provisioning profiles, please RENEW the provisioning profiles (File 1) and copy it into the "Payload/".
Make sure there's a Entitlements.plist (File 2) in the "Payload/", and this plist file MUST be PLAIN TEXT which is created by a text editor.
Make sure there's a Info.plist (File 3) in "Payload/", and this is created by XCode;
Copy the Entitlements.plist (File 4) anywhere else except the "Payload/".
Be sure "Bundle identifier" in File 1-4 should be the same.
Use this Entitlements.plist (File 4) to Re-Sign the IPA file.
You can resign it like this
codesign -fs "iPhone Distribution: Your Company Name" --entitlements=/Users/SenTR/Downloads/codesign/Entitlements.plist /Users/SenTR/Downloads/codesign/Payload/Your_Project_name.app
Entitlements.plist sample
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>PREFIX.yourappBundleID</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>PREFIX.yourappBundleID</string>
</array>
</dict>
</plist>
If you know Chinese, this will be helpful.
http://hennry.com/2015/03/fail-to-resign-ipa-since-ios8/
ios 8.1.3: inhouse app need distribute with MDM.
MobileInstallation
Impact: A malicious enterprise-signed application may be able to take control of the local container for applications already on a device
Description: A vulnerability existed in the application installation process. This was addressed by preventing enterprise applications from overriding existing applications in specific scenarios.
from apple release note

Resources