Jenkins generated ipa couldnt install on iPhone (iOS 9 + XCode 7.1) - ios

I am trying to implement Jenkins CI to generate build for iOS. I have latest Xcode 7.1 installed and ipa is getting generated without error. While trying to install the ipa through download link I am getting an error saying "Cannot install this time". Also I tried to install the same through iTunes, but getting an error saying "1 item could not be synced" and iTunes showing an error saying "The app "xxxxx" was not installed on the iPhone "xxxxxx" because an unknown error occurred (0xE8000005)".
Code signing certificate & provisioning profiles are proper and I am able to install the ipa generated from XCode.
Any help would be appreciated. Thanks :)

I was facing the same issue. Using Jenkins 2.5 and Xcode 7.3.1. Jenkins successfully build iOS app packaged the ipa, but the ipa did not install on the iPhone neither with iTunes nor when downloaded from TestFairy. Getting the same error "The app "xxxxx" was not installed on the iPhone "xxxxxx" because an unknown error occurred (0xE8000005)".
In the Jenkins logs I noticed following:
22:03:10 ### Checking original app
22:03:10 + /usr/bin/codesign --verify -vvvv /Users/jenkins/.jenkins/workspace/app-ios-build-job/build/MyAppProd.app
22:03:10 Program /usr/bin/codesign returned 1 : [/Users/jenkins/.jenkins/workspace/app-ios-build-job/build/MyAppProd.app: a sealed resource is missing or invalid
22:03:10 file added: /Users/jenkins/.jenkins/workspace/app-ios-build-job/build/MyAppProd.app/MyAppProd.app
22:03:10 ]
22:03:10 Codesign check fails : /Users/jenkins/.jenkins/workspace/app-ios-build-job/build/MyAppProd.app: a sealed resource is missing or invalid
22:03:10 file added: /Users/jenkins/.jenkins/workspace/app-ios-build-job/build/MyAppProd.app/MyAppProd.app
22:03:10
22:03:10 Done checking the original app
On further search found the answer posted by bladebunny at https://github.com/Carthage/Carthage/issues/782
Issue turned out to be duplicate package commands on Jenkins that resulted in the app being signed twice -- and then causing install to fail. Solution was to change Jenkins Xcode plugin settings. Under the 'General Build Settings' - we found you can't check both "Generate Archive" and "Pack application and build .ipa?" settings. The plugin issues log seems to suggest the former setting is being deprecated. We use the latter setting and are now able to successfully deploy the app with our custom dynamic framework.
The above fix worked for me.

Related

No matching provisioning profiles found - NativeScript iOS deploy

I want to publish an update of my NativeScript app into AppStore. Until yesterday the following steps worked:
move into app directory (from Terminal)
execute tns publish ios
enter valid e-mail & password combination
Now I need to do another update, but I keep getting the following error:
=== BUILD TARGET HandyApp OF PROJECT HandyApp WITH CONFIGURATION Release ===
Check dependencies
Code Sign error: No matching provisioning profiles found: No provisioning profiles matching an applicable signing identity were found.
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Command xcodebuild failed with exit code 65
# publish ios
I am working under Xcode 7.3. I checked my iPhone Developer certificate in Xcode and in my keychain, it is active and not expired. The Provisioning Profile is shown in Xcode. I ensured to use the certificate that is saved in apple.developer.com (by downloading it and replacing the old one in that directory).
I got:
my .mobileprovision
my .cer
my .p12
everything in the same directory.
Still there seems something not to be matching. I just can't figure out what might be running wrong. Does anyone know what else I could try to get it working?

Codesign returns unknown error after "replacing existing signature"

I am trying to build a Xamarin iOS app using xbuild on Jenkins. Sometimes the build fails during the codesigning process with an unknown error -1=ffffffffffffffff and sometimes the build succeeds. The provisioning profile is stored in a separate keychain jenkins.keychain (not the system or login keychain) that is referenced by Jenkins through the Keychains and Provisioning Profiles Plugin.
This is the console log of Jenkins:
Target _CodesignAppBundle:
Codesign Task
CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
DisableTimestamp: False
Entitlements: obj/iPhone/In-House/Entitlements.xcent
Keychain: <null>
Resources:
bin/iPhone/In-House/MyApp.app
ResourceRules: <null>
SigningKey: 123
ExtraArgs: <null>
IsAppExtension: False
Tool /usr/bin/codesign execution started with arguments: -v --force --sign 123 --entitlements /private/var/lib/jenkins/workspace/Master/Apps/iOS/obj/iPhone/In-House/Entitlements.xcent /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app
bin/iPhone/In-House/MyApp.app: error : /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: replacing existing signature
/private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: unknown error -1=ffffffffffffffff
Task "Codesign" execution -- FAILED
Done building target "_CodesignAppBundle" in project "/private/var/lib/jenkins/workspace/Master/Apps/iOS/MyApp.csproj".-- FAILED
As suggested in Codesign returned unknown error -1=ffffffffffffffff I added set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ${KEYCHAIN_PW} ${KEYCHAIN_PATH} to my build script but it did not fix the issue.
Do you have any idea how to address this issue? Why is there an existing signature to be replaced?
Update 1 - We keep getting the error after:
switching from xbuild to msbuild version 15.3.0.0
setting jenkins keychain to "Allow all applications to access this item"
deleting the derived data folder
not using relative paths for security commands
A similar problem is described in the Apple forum.
What fixed the issue:
The keychain filename extension changed from *.keychain to *.keychain-db on macOS Sierra. The code signing error was caused by referencing the old keychain file while we were editing in fact the jenkins.keychain-db file containing updated certificates. Keychains with the new extension are rejected from the upload with Jenkins' keychain plugin. So we do not use the keychain plugin any longer and store the signing certificates inside the login.keychain-db. With this we can successfully build the app without the unknown error.
My resolution to this problem was ensuring that the Mac had proper permissions to use the new certificate. I was getting this code signing issue when trying to run a Jenkins job, but things ran properly on my local machine. When I tried manually code signing one of the Swift libraries (e.g. libswiftos.dylib), the Mac then asked for a password to be able to use the new certificate. Once I did that, the Jenkins job ran successfully.
Restarting the Mac could Fix the issue

"No valid iOS code signing keys found in keychain"

I want to test an iOS application using Xamarin Test Recorder using iOS simulator. To do that I want to publish the project. When trying to publish it for archive, I got this error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com. (MobileApp1.iOS)
Do we need a certificate to publish the project?
When I drag and drop the .app to simulator it doesn't get installed. When I tried to install debug version it gives below error. Failed to chmod /Users/../Library/Developer/CoreSimulator/Devices/8A0508B3-0‌​2E8-4601-A239-B6712F‌​67FF4D/data/Library/‌​Caches/com.apple.con‌​tainermanagerd/Bundl‌​e/Application/1B8A7B‌​17-D9D0-44A6-8584-65‌​7FF1AB5815/MobileApp‌​1.app/MobileApp1 : No such file or directory" Release app also not get installed(No error or warning). Note that this is a xamarin project.What shall I do now?
First of all you do not need to sign/publish your app to use it with Test Recorder.
You can start recording tests from .app located on bin/iPhoneSimulator/Debug/ folder.
The “No valid iOS code signing keys found in keychain” happens when there are no provisioning profiles on your machine. The easiest fix is to create a new app from XCode and deploy it on the device, XCode will automatically downloads the required profiles and certificates

Crashlytics: Unable to package source due to error

I am setting up an Xcode Bot to automatically upload and distribute my beta app.
I have setup a mac with macOS Server and Xcode activated and am able to build and export an IPA manually just fine.
The Xcode Bot I created also archives and exports an IPA with no problem.
However, when I try to run the Crashlytics submit script in the Xcode Bot's post triggers, the uploading fails. But if I save the bot generated IPA and manually call the Crashlytics script via Terminal, it uploads just fine. It seems that only the Xcode Bot fails to submit to Crashlytics.
I have all the correct certificates installed on the server Keychain and everything works fine for manual archive/export both in Xcode and using the Xcode Bot's generated IPA.
Here is the log from Xcode Bot:
2016-11-22 17:15:53.942 submit Crashlytics: Crashlytics.framework/submit 1.3.5 (18)
2016-11-22 17:16:03.125 submit Crashlytics: Unable to package source due to error: Error Domain=CLSIPABuilderErrorDomain Code=-6 "(null)" UserInfo={UnderlyingError=Error Domain=CLSCodeSignerErrorDomain Code=-2 "(null)" UserInfo={arguments=(
"--sign",
ACFE8B8E177196BFF1974841752020FE96687508,
"--all-architectures",
"--force",
"--entitlements",
"/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73/Payload/entitlements.xml",
"/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73/Payload/Ebates Beta.app"
), environment={
"CODESIGN_ALLOCATE" = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate";
}, status=1, stderr=ACFE8B8E177196BFF1974841752020FE96687508: no identity found
, command=/usr/bin/codesign, stdout=}, SourcePath=/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73}
2016-11-22 17:16:03.187 submit Crashlytics: Failed to prepare the binary for release
Been pulling my hair out over this all day, hoping someone can shed some light on this problem.
Ok so turns out you need to run the app on a device directly from Xcode on the server machine so that Xcode will automatically generate all the appropriate XC iOS provisioning profiles. Apparently the Crashlytics script will re-package the IPA and need valid provisioning profiles in order to do so. I think the Xcode Bot generates an IPA but it is not fully code signed until you save from the bot results, instead of just running from a bot post-trigger.
If you go to the developer.apple.com portal and look under Provisioning Profiles you should see something like this:

"No code signing identities found" error building cordova app for iOS device

I am trying to build a cordova app for iOS here on my Mac, and I am plagued by the "No codesigning identities found" error. Based on other posts, the frequent resolutions include stopping and restarting Xcode and rebooting, and redownloading the provisioning profile. None of that has worked for me.
It is odd because I reference the provisioning profile by GUID in my build.json, but the error mentions the profile by name. This indicates to me that something somewhere is successfully locating the profile. So I am not sure why it isn't able to use it.
I get the error when I build at the command line using:
cordova build ios --device --buildConfig="build.json"
I would think I should be able to reproduce the issue by building in Xcode, but when I load the cordova project in Xcode and build it, it seems to be fine. But perhaps I am not doing the equivalent step in Xcode. I am just choosing to "Build" in Xcode. Perhaps there is another way to do the equivalent in Xcode?
This same codebase does build successfully on our build box, so this is undoubtedly a config issue here on my Mac. What do I need to do besides download and install the provisioning profile? I have done this both by downloading from Apple Developer and by directly installing through the Xcode preferences.
Below is the exact error I am getting:
Code Sign error: No codesigning identities found: No codesigning identities (i.e. certificate and private key pairs) that match the provisioning profile specified in your build settings (“[the name of our profile]”) were found.
I am a relative novice building an app developed by someone else. I have tried everything near the top of the Google search results for this error, but not much else. I am likely missing something obvious. Pointers and help would be greatly appreciated.
I had not installed the Enterprise distribution certificate with the private key here on my Mac. Once I did that it worked.

Resources