Unable to Debug/Install Watch App Extension - cocoapods

I have been having this issue for quite some time and have been unable to fix this. About 90% of the time, my watch app fails to install on the device. The App will show installation to about 80% completion, then fail and quit, providing this error in the
iPhone debug log console
<Error>: 0x4029b000 __106-[ACXCompanionSyncConnectioninstallWatchAppWithBundleID:withProvisioningProfileInfo:completionWithError:]_block_invoke_3: Failed to install app com.mea.AppName.watchkitapp : Error Domain=ACXErrorDomain Code=17 "Got error 17 in install done from remote side (MI error ApplicationVerificationFailed ; Extended 0xe8008017 ; Desc Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex : 0xe8008017 (A signed resource has been added, modified, or deleted.))" UserInfo={FunctionName=-[ACXServerInstallOperation receivedDictionaryOrData:], SourceFileLine=524, NSLocalizedDescription=Got error 17 in install done from remote side (MI error ApplicationVerificationFailed ; Extended 0xe8008017 ; Desc Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex : 0xe8008017 (A signed resource has been added, modified, or deleted.))}
Watch Debug Log Console, these errors are thrown.
Verification stage failed
Jul 21 09:46:59 Andrews-AppleWatch appconduitd[104] <Error>: 0x1f084000 __MobileInstallationInstallForLaunchServices_block_invoke222: Returned error Error Domain=MIInstallerErrorDomain Code=13 "Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex : 0xe8008017 (A signed resource has been added, modified, or deleted.)" UserInfo={LibMISErrorNumber=-402620393, LegacyErrorString=ApplicationVerificationFailed, FunctionName=+[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:], NSLocalizedDescription=Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex : 0xe8008017 (A signed resource has been added, modified, or deleted.), SourceFileLine=142}
Because of these pod frameworks (which apparently have been modified) that I am using in my watch extension.
SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jul 21 09:46:58 Andrews-AppleWatch installd[35] <Notice>: MIS: resource modified: /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex/Frameworks/Alamofire.framework/Alamofire
Jul 21 09:46:58 Andrews-AppleWatch installd[35] <Notice>: MIS: resource modified: /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex/Frameworks/Realm.framework/Realm
Jul 21 09:46:58 Andrews-AppleWatch installd[35] <Notice>: MIS: resource modified: /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex/Frameworks/RealmSwift.framework/RealmSwift
Jul 21 09:46:58 Andrews-AppleWatch installd[35] <Notice>: MIS: resource modified: /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.eC3skb/extracted/Payload/Watch.app/PlugIns/Watch Extension.appex/Frameworks/SwiftyJSON.framework/SwiftyJSON
Now, I understand that this has to do with code signing (right?), but how do I go about updating or verifying the correct code signature?
I see that other people have had a similar issue by having a non-alpha/non-numeric symbol in their Product Name, however, my Product name is AppNameWatch, and AppNameWatch Extension. Apple generates the Extension file with the space character in-between AppNameWatch and Extension, so I assume that that is fine and not the cause of the problem.
I have also tried cleaning/re-building/cleaning the build folder and deleting derived data.
Any help would be greatly appreciated, thank you.
EDIT/UPDATE:
Looks like this is an issue related to cocoapods. After moving all my frameworks to be managed by Carthage, the app is installing and running as it should with no errors related to modified resources.

I was having the same problem after I updated my project to use dynamic frameworks through CocoaPods. I had to go to the WatchKit Extension and change Embedded Content Contains Swift Code to Yes. Now the app builds and installs fine.

Related

How to troubleshoot when Safari App Extension not appear in Safari Preferences?

I'm developing a Safari App Extension. Previously it worked fine. When I run the project in Xcode, and enable Allow Unsigned Extensions in Safari, I can see my extension in Safari Preferences -> Extensions page.
After I merged code with one of my team member, suddenly the Extension cannot get installed.
I have tried:
Clean the build folder in Xcode, and run again. But no luck.
Restart Xcode doesn't help either.
Use command pluginkit -mAvvv -p com.apple.Safari.extension to check installed Safari extensions list. My extension is not in the list.
There are some errors in Xcode output, but I can't link them with the issue I'm facing:
objc[49476]: Class AMSupportURLConnectionDelegate is implemented in both /System/Library/PrivateFrameworks/EmbeddedOSInstall.framework/Versions/A/EmbeddedOSInstall (0x7fff9a2aa748) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x108db2600). One of the two will be used. Which one is undefined.
objc[49476]: Class AMSupportURLSession is implemented in both /System/Library/PrivateFrameworks/OSPersonalization.framework/Versions/A/OSPersonalization (0x7fff9b5d49f0) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x108db2650). One of the two will be used. Which one is undefined.
2018-12-13 16:25:46.003099+0800 Safari[49476:1264277] Could not connect action, target class SecurityPreferences does not respond to -toggleJavaScriptCanOpenWindows:
2018-12-13 16:25:46.163130+0800 Safari[49476:1264277] AssertMacros: 0 (value = 0x0), file: /BuildRoot/Library/Caches/com.apple.xbs/Sources/BiometricKit/BiometricKit-75.71.1/BiometricKit/BiometricKitXPCClient.m, line: 75
2018-12-13 16:25:46.163219+0800 Safari[49476:1264277] AssertMacros: 0 (value = 0x0), file: /BuildRoot/Library/Caches/com.apple.xbs/Sources/BiometricKit/BiometricKit-75.71.1/BiometricKit/BiometricKitXPCClient.m, line: 396
2018-12-13 16:25:46.163465+0800 Safari[49476:1264277] [Framework-Internal-Legacy] AssertMacros: _xpcClient (value = 0x0), file: /BuildRoot/Library/Caches/com.apple.xbs/Sources/BiometricKit/BiometricKit-75.71.1/BiometricKit/BiometricKit.m, line: 137
2018-12-13 16:25:47.060959+0800 Safari[49476:1264368] [RemotePlistController] The downloaded plist could not be loaded: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
2018-12-13 16:25:47.128105+0800 Safari[49476:1264277] Scheduling the NSURLConnection loader is no longer supported.
2018-12-13 16:25:47.491811+0800 Safari[49476:1264370] NSURLConnection finished with error - code -1100
2018-12-13 16:25:47.799590+0800 Safari[49476:1264514] [CloudBookmarks] Error fetching remote migration state: Error Domain=com.apple.SafariBookmarksSync.CloudBookmarksErrorDomain Code=0 "(null)"
2018-12-13 16:25:47.953259+0800 Safari[49476:1264277] [WebKit2Callbacks] Page (pid: 0) did become unresponsive
2018-12-13 16:25:47.970927+0800 Safari[49476:1264512] NSURLConnection finished with error - code -1100
2018-12-13 16:25:48.032647+0800 Safari[49476:1264425] [RemotePlistController] The downloaded plist could not be loaded: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
2018-12-13 16:25:48.125530+0800 Safari[49476:1264426] Calling IOPPFGetProperty simulator_utility_clamp!
2018-12-13 16:25:48.840769+0800 Safari[49476:1264277] [WebKit2Callbacks] Page (pid: 49481) did become responsive
Now I'm running out of options. It lacks official documentation in Apple Developer site.
Is there regular steps to troubleshoot this kind of issue? Is there any kind of system logs which can help me address the error? Any suggestion is appreciated.
Make sure that the extension .appex is listed as embedded content for your App Extension target. Otherwise it doesn't get bundled when you build from Xcode. Look in the project editor under Target_Name > General > Frameworks, Libraries and Embedded Content. The extension should be listed there.
Also check under the Build Phases tab > Dependencies that your extension is added there as well.
Check to see if the code signature of your app is valid. Safari will refuse to list your extension otherwise. Run codesign on your built app as follows:
codesign -d --verify --verbose=3 ~/Library/Developer/Xcode/DerivedData/OnePassword-epeydspviethpabprcrsqenrkiin/Build/Products/Debug_WebStore/1Password\ 7.app
It should show valid on disk and satisfies its Designated Requirement. If it doesn't, Safari will ignore your extension completely, even when Allow Unsigned Extensions is enabled.
I had a similar problem more recently after updating to Xcode 13.2.1 and a I think a MacOS update. My Safari web extensions I was developing stopped showing up in Safari (even with unsigned extensions enabled).
In a Terminal/CLI shell, I ended up running:
PATH=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support:"$PATH"
lsregister -f /Applications/Safari.app
And suddenly my extensions started showing up again in Safari. Something screwy happened with Safari and LaunchServices.

ATSFontGetFileReference failed: error - Mac OS X and R

I recently installed R on a new Macbook Pro running Mountain Lion. When trying to plot data, I get a slew of ATSFontGetFileReference errors, and text doesn't render (though chart elements do):
> plot(study$outcome, study$predictor)
Jan 21 10:55:57 tatou.local R[35029] <Error>: ATSFontGetFileReference failed: error -50.
Jan 21 10:55:57 tatou.local R[35029] <Error>: ATSFontGetFileReference failed: error -50.
Jan 21 10:55:57 tatou.local R[35029] <Error>: ATSFontGetFileReference failed: error -50.
Jan 21 10:55:57 tatou.local R[35029] <Error>: ATSFontGetFileReference failed: error -50.
...
It seems like more of an OS X issue than R, since a little Googling has turned up similar errors for PDF renderers, etc. But I can't seem to find a solution...
All my fonts as well as R appear to be installed for use system-wide. Ideas?
I had the same error using RStudio on OSX 10.7.5. I saved my workspace and then quit RStudio. Upon opening it back up and loading my saved workspace, I ran the plot(x,y) command and there was no longer an error, with the text being displayed as expected.
I don't know your font situation exactly, but I just fixed this issue on mine. I have a mac, and helvetica is automatically installed as a .dfont file. I had downloaded a helvetica.ttf file and put it in 'mac_hd/libary/fonts'. Once I deleted this and restarted R I haven't had the problem. My error was verbatim ' ATSFontGetPostScriptName failed: error -984. ' (I included that to help with google results)

Distributing In-House iPad app is now generating code signing error in Lion using Xcode 4.3.2 (4E2002)

After upgrading our Jenkins CI Mac mini to Lion and Xcode 4.3.2 (4E2002) we now receive an
unrecognized status -67068 from code signing
In the past code signing worked just fine, before we upgraded to Lion and the new Xcode. Now that all our developers are using Lion and the new version of Xcode, we were forced to update our CI box. Any help would be greatly appreciated.
May 10 18:17:49 unknown installd[70] : unrecognized status -67068 from codesigning library
May 10 18:17:49 unknown installd[70] : 00281000 verify_signer_identity: Could not copy validate signature: -402620415
May 10 18:17:49 unknown installd[70] : 00281000 preflight_application_install: Could not verify executable at /var/tmp/install_staging.aKaDJC/foo_extracted/Payload/Test.app
May 10 18:17:49 unknown installd[70] : 00281000 install_application: Could not preflight application install
May 10 18:17:49 unknown com.apple.itunesstored[110] : MobileInstallationInstall: failed with -1
May 10 18:17:50 unknown installd[70] : 00281000 handle_install: API failed
May 10 18:17:50 unknown installd[70] : 00281000 send_message: failed to send mach message of 71 bytes: 10000003
May 10 18:17:50 unknown installd[70] : 00281000 send_error: Could not send error response to client
May 10 18:18:18 unknown profiled[65] : (Note ) profiled: Idled.
May 10 18:18:18 unknown profiled[65] : (Note ) profiled: Service stopping.
Thanks to ThomasW I was able to Google, "Cannot find code object on disk", and found this article.

Xcode 4.2 can't debug iOS 4.2.1 (8C148)

I recently updated to Xcode 4.2. I also updated my new iPad 2 and iPod (latest generation) to iOS 5. I build my app and can debug them no problem.
My older iPod running iOS 4.2.1 (8C148) doesn't run and doesn't give any errors.
The top center panel says "Finished running MyApp on iPod One". (iPod One is the name of my first iPod touch)
There is a flicker at the bottom of Xcode as if it almost went into the debugger and was about to show the bottom output panel but it doesn't. A break point in main doesn't stop it either.
I have no errors and nothing to go on.
I have renewed all provisioning profiles, restored the device, selected "use for development", nothing has helped.
Since there is no feed back from Xcode I do not know what to do.
p.s. The app runs in all of the simulators fine as well.
When I initially select the iPod I see the following series of messages in the console for the devices as shown from the Organizer:
Thu Oct 20 09:42:49 unknown lockdownd[16] : 2ffea000
handle_connection: Could not receive USB message #6 from Xcode.
Killing connection Thu Oct 20 09:42:49 unknown
com.apple.mobile.lockdown[16] : Could not receive size of
message Thu Oct 20 09:42:50 unknown
/Developer/Library/Daemons/DTFetchSymbols[308] : Found paths:
Thu Oct 20 09:42:50 unknown
/Developer/Library/Daemons/DTFetchSymbols[308] : /usr/lib/dyld
Thu Oct 20 09:42:50 unknown
/Developer/Library/Daemons/DTFetchSymbols[308] :
/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv6 Thu Oct
20 09:42:50 unknown com.apple.mobile.lockdown[16] : Could not
receive size of message Thu Oct 20 09:42:50 unknown lockdownd[16]
: 2ffea000 handle_connection: Could not receive USB message #6
from Xcode. Killing connection Thu Oct 20 09:42:56 unknown
lockdownd[16] : 2ffea000 handle_connection: Could not receive
USB message #6 from MDCrashReportTool. Killing connection
I had the same problem, but I solved it. The cause
unsuported architecture (by default Xcode4.2 uses standard arch= armv7 ) -> add armv6
In addition to adding the armv6 architecture, I had to remove the armv7 entry from my apps info.plist "Required Device Capabilities" entry.

Xcode 4 final - breakpoints on device (ipad) not working

I downloaded and installed final version of Xcode 4. I opened my iPad project and realised that breakpoint's doesn't work on the device. They work ok on simulator though.
Before I was using Xcode 3.2 and everything was working fine.
I also tried creating an empty view based iOS application from scratch and have exactly this same issue. I was googling on that issue, but all solutions were based on previous versions of Xcode.
Any suggestions what am I doing wrong ?
Here is output from a console when running application
Mar 10 14:34:44 unknown installd[547] : entitlement 'keychain-access-groups' has value not permitted by a provisioning profile
Mar 10 14:34:44 unknown installd[547] : entitlement 'application-identifier' has value not permitted by a provisioning profile
Mar 10 14:34:44 unknown SpringBoard[29] : Killing me.device-debugging-test activate: deactivate: for app installation
Mar 10 14:34:44 unknown installd[547] : entitlement 'keychain-access-groups' has value not permitted by a provisioning profile
Mar 10 14:34:44 unknown installd[547] : entitlement 'application-identifier' has value not permitted by a provisioning profile
Mar 10 14:34:44 unknown SpringBoard[29] : Reloading application state for 'me.device-debugging-test' as its modification date has changed
Mar 10 14:34:45 unknown SpringBoard[29] : Reloading and rendering all application icons.
Mar 10 14:34:46 unknown com.apple.debugserver-48[551] : debugserver-48 for armv6 Copyright (c) 2007-2009 Apple, Inc. All Rights Reserved.
Mar 10 14:34:46 unknown com.apple.debugserver-48[551] : Connecting to com.apple.debugserver service...
Mar 10 14:34:47 unknown com.apple.launchd[1] : (UIKitApplication:me.device-debugging-test[0x4309]) Spawned and waiting for the debugger to attach before continuing...
Mar 10 14:34:47 unknown com.apple.debugserver-48[551] : Got a connection, waiting for debugger instructions for task "(null)".
Mar 10 14:34:47 unknown kernel[0] : lockbot[544] Builtin profile: debugserver (sandbox)
Mar 10 14:34:47 unknown kernel[0] : launchd[552] Builtin profile: container (sandbox)
Mar 10 14:34:47 unknown kernel[0] : launchd[552] Container: /private/var/mobile/Applications/(...) [69] (sandbox)
Reboot your device.
Short, sweet, and simple solution.
After hours spent digging through all the XCode options.

Resources