Ios – App installation failed: Unknown Error Xcode 7

iosiphoneswiftxcodexcode7

My app runs fine in the simulator, but when I try to install it on my iPhone it says

App installation failed: An unknown error has occurred.

I opened my device logs and got this:

Nov 12 21:17:19 Isaacs-iPhone streaming_zip_conduit[5853] : LaunchServices: installing app for existing placeholder Raritea.FSS-App <(null) Not found in database>
Nov 12 21:17:19 Isaacs-iPhone streaming_zip_conduit[5853] : LaunchServices: Not creating progress for Raritea.FSS-App <(null) Not found in database> since it is not a placeholder.
Nov 12 21:17:19 Isaacs-iPhone installd[4549] : 0x16e1bb000 -[MIClientConnection installPath:withOptions:completion:]: Install of "/var/mobile/Media/PublicStaging/FSS App.app" type Developer (LSInstallType = (null)) requested by streaming_zip_conduit (pid 5853)
Nov 12 21:17:19 Isaacs-iPhone installd[4549] : 0x16e12f000 -[MIInstaller performInstallationWithError:]: Installing
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Provisioning profiles changed
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Updating MIS trust…
Nov 12 21:17:20 Isaacs-iPhone securityd[4588] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Nov 12 21:17:20 Isaacs-iPhone securityd[4588] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Provisioning profiles changed
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Updating MIS trust…
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : unrecognized status -67049 from codesigning library
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : 0x16e12f000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 142: Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : 0x16e12f000 -[MIInstaller performInstallationWithError:]: Verification stage failed
Nov 12 21:17:20 Isaacs-iPhone streaming_zip_conduit[5853] : 0x16e087000 __MobileInstallationInstallForLaunchServices_block_invoke222: Returned error Error Domain=MIInstallerErrorDomain Code=13 "Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)" UserInfo={LibMISErrorNumber=-402620415, LegacyErrorString=ApplicationVerificationFailed, SourceFileLine=142, FunctionName=+[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:], NSLocalizedDescription=Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)}
Nov 12 21:17:20 Isaacs-iPhone streaming_zip_conduit[5853] : ERROR: MobileInstallationInstallForLaunchServices returned nil
Nov 12 21:17:20 Isaacs-iPhone streaming_zip_conduit[5853] : __dispatch_source_read_socket_block_invoke:274: Failed to install application at file:///var/mobile/Media/PublicStaging/FSS%20App.app/ : Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=ApplicationVerificationFailed, ErrorDetail=-402620415, ErrorDescription=Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)}

Best Answer

This line in the device logs stood out to me, and hopefully you saw it too:

Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex

This is saying that (although Xcode thought everything was OK at build time), your device rejected the code signature of your app extension.

There are a few solutions here, but in my personal experience, this issue can only be fixed by tinkering with the code signing settings for your app and app extension. Make sure that the app and app extension are being signed with the same certificate (although likely different provisioning profiles).

As others have recommended, I've also been able to fix this by running the Clean action in Xcode for the project, and also by deleting the derived data directories. But I have not always been successful with this.