Xcode - Error launching WatchKit Extension - ios

I've successfully built a basic Watch/iPhone app and am getting the following error when trying to run on my devices:
"Error Launching 'app_name WatchKit Extension'
The operation couldn’t be completed. Unable to launch because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user."
The app does install to the watch/phone, but I want to use the extension to view console output while running the app.
I am using automatic provisioning, which is not giving any errors. I am not using Apple's paid developer program. Has anybody experienced this before? Cheers.

This setting should be set to Trust(your Apple id) in Settings -> General -> Device Management ->

I resolved this by opening the app on the Apple Watch for the first time, then selecting "Trust developer" on the prompt that appeared.

The workflow seems to be different depending on your usecase:
WatchOS app with iPhone app
Standalone WatchOS app
For usecase 1, I had to trust myself as a developer in the iPhone Settings -> General -> Device Management. Note, you need to try and run the app on your devices before the menu option is available on the iPhone.
For usecase 2, I had to trust myself as a developer at the prompt that was shown when I opened the app on the watch for the first time.
My advice would be to try to get usecase 1 working first, before trying usecase 2. Note, if you have a free developer account you will need to uninstall the usecase 1 app from the iPhone and from the watch before you can install usecase 2, as the free account only supports one app at a time.
I wasted time by starting with usecase 2 and could not get it to work for some reason. After I gave up and did usecase 1, then subsequently tried my usecase 2 app again without changing any XCode settings, it just seemed to work for some unknown reason.
I'm using XCode 11.4, iOS 13.4 and WatchOS 6.2 on iPhone 7 Plus and Apple Watch 2 42mm

Related

Apple WeatherKit Error Xcode 14 Beta 5 iOS 16

Trying to get the WeatherKit Beta working. have had the same error on Xcode 14 Betas 3/4/5 on both the simulator and physical device using the apple provide an example from WWDC or a simple project to load weather data.
The error output is always:
2022-08-12 15:56:02.825925-0400 WeatherPup[47533:15014528] [AuthService] Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=AMSErrorDomain Code=12 "Mescal Failed" UserInfo={NSLocalizedDescription=Mescal Failed, NSLocalizedFailureReason=SAPInit failed: -42049}
Has anyone been successful in building using this Beta yet? I would imagine it should work since the dark sky weather service is still running.
I have all certificates, identifiers, and privileges setup as they should be and triple-checked bundle identifiers, etc.
I've had the same issue and here are the 2 things I had to do to make it work:
Make sure that you have the WeatherKit checkbox checked under the development portal in both places - Capabilities and App Services:
As of Beta 5 I've only been able to successfully fetch weather information from the API when building on a real device.
I believe it has been generally confirmed that WeatherKit is not working correctly on XCode simulators. I haven't been successful yet with a Sim but physical iPhone device works fine. WK documentation is lacking.
I have the same issue. It doesn't work on simulator XCode 14 beta 6 and earlier.
It's working only on physical device with iOS16 Beta
Except of using physical device be sure You:
1.Configured correctly identifier. You have to select "WeatherKit" under "Capabilities" and "App Services" and waited at least 30min
2.Be sure You have added WeatherKit capabilities in XCode under Singing & Capabilities tabs in project settings
For more info visit:
https://help.apple.com/developer-account/?lang=en#/devfe6684fd6
https://developer.apple.com/weatherkit/get-started/

Could not attach to pid : “557”

I am currently building an iMessage extension app and whenever I try to build and run the app on a device I get an error.
Could not attach to pid : “557”
Domain: IDEDebugSessionErrorDomain
Code: 3
Failure Reason: Error 1
The app builds fine for the simulator; however, it doesn’t work on devices. I have tried multiple devices including an iPhone 6+ running iOS 12.4.6 and an iPhone X running iOS 13.4.1.
I have already done sudo DevToolsSecurity -enable in the terminal for the Mac. Is there anything that must be done to set up the device itself?
If anyone could help me get the app running on a device that would be great because you can't have an app that doesn't work on the device itself.
Thanks! :)
Quit Xcode, clean build, clear derived data and run again, this works usually for me.
It was a simple mistake in that the developer had to be trusted on the device. If you have this problem go to the following on the device:
Settings > General > Device Management
Tap on the profile for the developer of the app you are testing and click trust.
I also encountered this problem when i was build mac app, and my solution is as follows, set the Xcode settings:
TARGETS -> Build Settings -> Signing
set Code signing inject base entitlements as Yes

Cannot run app on real Apple Watch

my configuration: Apple Watch (WatchOS 2.0.1), iPhone 5S (iOS 9.1) Xcode 7.1 on MacOS X El Capitan.
I can run my app on the iPhone just fine. However, when I try to run my app on the Apple Watch, it seems like it's not possible. What I see in the status bar is the usual steps
Building MyApp on Apple Watch
Installing to Apple Watch
Running MyApp on Apple Watch
And then, in less that a second, it shows
Finished Running MyApp on Apple Watch
As if I had just pressed the stop button in Xcode (but without my having pressed it at all). No error message or warning. It just stops.
As a result, I'm not able to debug my app on the Apple Watch to see the log messages, memory usage, etc.
Any ideas? Thanks in advance for your help!
When this happened to me, I fixed the issue by:
Making sure there are no problems with your Main.storyboard and it has an initial view controller.
Deleted app on phone
Rebooted phone
Rebooted watch
Quit xcode and rebooted mac
You could build the app to iPhone first, wait the watch app sync to watch. (Or you could sync it in companion by turn off and turn on the install switch manually)
Then keep the app running on watch, select Xcode->Debug->Attach to Process->XXXXX Extension(the name of your watch extension)
After a while you should be able to debug the watch app.
After restarting all my devices twice to no avail, here are some tips that sometimes solve the issue. (This whole thing is a headache.) I usually use the combination of these 3 things and it works 90% of the time.
Build for a simulator and then switch back to a real device again.
Switch the Info/Launch scheme setting to "Wait for the executable to be launched", run the project and then switch back to "Automatically".
Delete the Derived Data folder located under ~/Library/Developer/Xcode/DerivedData.
This drove me up the wall when starting out. I found 2 solutions:
Stop wasting time developing for Apple Watch
Found my XCode was disconnecting from my Apple ID. Went to XCode -> Preferences -> Accounts. And noticed "Your session expired, please log in." I could run to iPhone no problem with this error but on Apple Watch it would get stuck on "Running ... Apple Watch"

iOS enterprise distributed app terminates without any error log

I have very weird distribution scenario with the iOS app.
App works normally in simulator
App works normally on the device with developer profile (and corresponding bundle id domain.product)
When downloaded from testFairy service with valid enterprise provisioning profile app and bundle id (in form domain.beta.product) app:
Installs without error
Shows lunch screen and terminates immediately
When I connect device and check logs through Xcode -> Devices -> Show log I don't see any today's crashes, like no error happened. (this confuses me the most)
This happens on 2/2 iPhone devices that tried to run the app.
Some other infos that could maybe ring a bell to someone:
- App uses Core Data
- App uses TestFairy SDK (but it was the same without it)
- target is iOS 7.0, base SDK is Latest iOS(iOS 8.1)
- provisioning profile is set to that Enerprise Profile and signing identity is set to corresponding certs for both debug and release.
- I've removed armv7 from Targets-> Info -> Required Device capabilities as suggested on some stack overflow solutions.
Anyone experienced similar problem? What could be the cause?
I work for TestFairy, I think I can assist.
Few points:
TestFairy's distribution does not alter the IPA in any way.
When using an enterprise profile, you need to sign using (TEAM.domain.company.app) in your application-identifier. iOS 8 shouldn't let you install if the identifier does not include the TEAM.
If the app crashes immediately (with or without the Default splash screen,) it might be because you're out of memory. Does rebooting fix the problem?
Can you please paste all the logs from right before the launch, till the app exits? you can attach and send to TestFairy's support (via Contact page.) That would be helpful. Also, if you're interested, you can email support with your username and link to build, and they can try installing it on their devices and let you know what the problem was.

Xcode process launch failed: Security

I have been developing an app for 1 or 2 weeks now and just yesterday I have updated my iPhone 5S to the iOS 8 GM. Everything worked fine and I could test on my device as well until I deleted the app from my phone and wanted to build again. The following error appeared:
Could not launch "My App"
process launch failed: Security
When I test with the simulator it works fine.
Is this because of the iOS 8 GM update and how can I fix this launch problem?
I want to be able to test on my iPhone and in the simulator.
If you get this, the app has installed on your device. You have to tap the icon. It will ask you if you really want to run it. Say “yes” and then Build & Run again.
As from iOS 9, it is required to go to Settings → General → Device Management → Developer App → Trust`.
On some versions of iOS, you will have to go to Settings → General → Profile instead.
Updated answer for Xcode 7: Tapping the app no longer works (as of beta 1 it just displays an "untrusted enterprise developer" message with only a Dismiss button).
To fix, open the Settings app, go to General / Profiles, and you'll see your profile. Mark it trusted and things should start working normally again.
Updated For iOS 9.2.1 and Xcode 7.2.1:
Goto: Settings > General > Device Management > Select App from Developer Apps > Trust App.
Hey so the accepted answer works, except if you need to debug the initial launch of the app. However I think that answer is more of a work around, and not an actual solution. From my understanding this message occurs when you have some weirdness in your provisioning profile / cert setup so make extra sure everything is in tip-top shape in that dept. before ramming your head against the wall repeatedly.
What worked for me was as follows from the apple docs:
Provisioning Profiles Known Issue If you have upgraded to the GM seed
from other betas you may see your apps crashing due to provisioning
profile issues.
Workaround:
Connect the device via USB to your Mac
Launch Xcode Choose Window ->Devices
Right click on the device in left column, choose "Show
Provisioning Profiles"
Click on the provisioning profile in question
Press the "-" button Continue to removing all affected profiles.
Re-install the app
Make sure you right click on the image of the device not the name of the device or you won't see the provisioning profiles option. I restored my new phone from an old backup and there was a lot of cruft hanging around, i also had 2 different dev. certs active (not sure why) but i deleted one, made a new profile got rid of all the profiles on device and it worked.
Update for iOS9.2.1 and Xcode 7.2.1
If you get this error when building to a device in Xcode:
On your device, tap the app icon that would have just been added from your attempt at building the app and you should see this:
Next, on your device, go to Settings --> General --> Device Management, and you will see this page:
Select the profile you are using with Xcode, and you should see this page:
Click Trust "username#email.com" then click Trust on the next popup.
Go back to Xcode and re-run your project and it should build the app to your device.
To get around the process launch failed: Security issue and immediately launch the app on your device, tap the app icon on your iOS device after running the app via Xcode.
This will allow you to immediately run the app. It may not actually "fix" the root issue that is causing these permission alerts.
Be sure to tap the app icon while the Xcode alert is still shown. Otherwise the app will not run. I continually forget this vital step and am unable to run the app on my device. Thus I am documenting it here for myself and everyone else :)
Run the app via Xcode. You will see the security alert below. Do not press OK.
On your iOS device, tap the newly installed app icon:
After tapping the icon, you should now see an alert asking you to "Trust" the Untrusted App Developer. After doing so the app will immediately run, unconnected to the Xcode debugger.
If you do not see this "Trust" alert, you likely pressed "OK" in Xcode too soon. Do not press "OK" on the Xcode alert until after trusting the developer.
Finally, go back and press "OK" on the Xcode alert. You will have to re-run the app to connect the running app on your iOS device to the Xcode debugger.
Go to SETTINGS -> GENERAL -> Profiles & Device Management
and choose the developer profile, then push Trust.
if you do not have Profiles & Device Management menu, you have to enroll your device on beta.apple.com and download the profile from Safari.
Install the profile
Restart your device
Tap on the developer profile and trust.
You are all set.
I have the same issue. I click ok in xcode and when launching the app on my iPhone I'm asked if I want to trust this application. Doing it, the app runs and further build-and-run from xcode went without any issue until deleting the app from the iPhone and reinstalling it. Then goto first line ;-)
Alternatively if one does not see "Untrust App Developer" dialog:
Go to your iPhone > Settings > General > Profile > "you#email.com" > Trust
In iOS 9.2 they renamed the 'Profiles' to 'Device Management'
This is how you should do it now:
Settings -> General -> Device Management
Verify the app
Ok, this seems late and I was testing the app with the Internet connection off to test my app for some functionality. As I turned off the Internet, it gave me such an error. After I turned on the Internet, I could install it again. I know this is silly but this might be helpful to someone.
I had this issue before on Xcode 7. Then I realized it's all about my Internet connection: it was down, and the security check was using the
Internet to make sure your developer account is correct. And when it saw no Internet it gave this error … after I have fixed my Internet, it works well.
Xcode is able to build and install the app, but isn't able to launch it the first time. You just need to tap on the app's icon on the phone, then you will be prompted to ask if you want to trust the developer. Allow it and the app will launch, then Xcode will be able to automatically install & launch this and your other apps.
"If you get this, the app has installed on your device. You have to tap the icon. It will ask you if you really want to run it. Say “yes” and then Build & Run again."
To add to that, this only holds true the moment you get the error, if you click OK, then tap on the app. It will do nothing. Scratched my head on that for 30 odd minutes, searching for alternative ways to address the problem.
BTW, this also happens if you change the team of your target in Xcode and rebuild. Was quite puzzled to see that problem with an app that I had run on the device before. Took me a while to figure out…
Might only happen the first time building to a device with a team, though.

Resources