Apple Watch Simulator completely fails to start or load app with message "Waiting to attach" - ios

The Apple Watch Simulator always fails to load my WatchKit App. The entire process has always been quite flaky, but for a reason I can't figure out, the Watch simply hangs on a black screen without loading anything. No home screen, no app, no spinner, no time or date.
I've tried:
All combinations of clean/launch/stop/quit/reload/restart/etc..
Resetting simulator content and settings
Different versions of the sim, phone, iOS, etc
Recreating the scheme
Checking the code hasn't been trashed by accident, and the "Startup Interface"
Going to the WatchKitSettings (Apple Watch) app on the sim:- it's empty.
All I see is the title (e.g. Apple Watch 42mm); the rest of the screen is black.
The only thing that's changed in the project recently is the addition of Launch Files and Icon files. But the WatchKit target does not have any of these.
It's like there's a problem somewhere down in the depths of the WatchKit installation/xCode debugger. I often get the message "Waiting to attach" in the debug navigator (sometimes repeated multiple times), sometimes the message "No Debug Session" remains.
Does anyone please have any helpful tips or experience with a similar situation that might get me building again?

This turned out to be a combination of:
a problem with the project's (Apple Watch, iOS App & WatchkitExtension) Bundle Identifier
Check your bundle IDs are all correct and the parts that need to match match
Check your provisioning profiles include the ID, are set to the correct team and match throughout the project's targets
A problem with the signing of the WatchkitBundle
Due in parts to the issues noted above, but also related to the "Skip Install" 'Build Setting' of the Watchkit App
Usual steps of reset simulator, restart xcode and machine. XCode 7 is a poor effort so far.

Related

Xcode 8 app runs on Simulator but doesn't display

I'm using the release version of xCode 8 and am trying to run my app on the simulators. They are all the iOS 10 simulators.
No matter which simulator I use, when I run the app the app icon shows up in the simulator but then that's it. The app never displays in the simulator. I only see the app icons of the iOS home screen.
I put some break points in my initial view controller at the viewDidLoad, viewWillAppear, and viewDidAppear methods. All of them triggered. So as far as my app is concerned, it is displaying on the device. I also get all the normal log output and networking calls happening just fine. It even shows the popups for permission to access the calendar and notifications. But my app is not brought to the foreground.
If I then click on the app icon in the simulator, my app runs normally. But it should be automatic when I hit run from xCode.
When I run my app on an iOS 10 device I get the same behaviour as all three of those view methods are called. However I don't get any of my normal log output. In fact I don't get any log output. However the app was already installed from when the device was on iOS 9.x. Not sure if that is a factor. But aside from the simulator issues, this is the bigger issue.
I've tried cleaning the build, deleting the app, I even tracked down the derived data folder and deleted that from the simulator. None worked. I also updated all my cocoa pods I have installed too.
Any one else experienced this?
That sounds weird but I read a lot of threads on the Apple Developer Forums on the same problem during the different Xcode 8 beta version, try these steps:
reset the simulator using the menu "iOS Simulator" -> "Reset Content and Settings..."
remove your 'xcuserdata' directory inside your .xcodeproj directory
do a clean build folder (hold down option key when selecting clean)
reboot your Mac
If these steps don't solve anything you can try this solution:
Copy-paste Xcode-beta.app from Applications folder to somewhere else, e.g. - Documents folder.
Delete Xcode-beta.app from Applications folder.
Move Xcode-beta.app from Documents to Applications folder again.
originally posted here, obviously using your Xcode.app instead of Xcode-beta.app.

App crash when launching from Xcode if app already installed on device through Testflight

I'm building an iOS app for which I have Testflight set up, but now I'm running into an interesting issue where I can't properly launch the app from Xcode anymore since I registered my device to test the app through Testflight.
When I try to launch the app from Xcode, it will build fine and even launch it on my phone. However, there will be no output in the console, and a few seconds later the app will crash on my phone and I get the following error message popup in Xcode:
process launch failed: failed to get the task for process 484
If I delete the app from my phone before trying to launch from Xcode, the same thing will happen and the Testflight orange dot will still show up next to the app name on the home screen.
I have tried to change the app's version and build number, but that had no effect. I have not yet tried to unregister my device to test the app through Testflight because I would like to find a good way that facilitates both.
One way I have found to circumvent this problem is create a different app target and run the app with that which seems to work -- but I'm wondering if there is an actual solution to this problem or a better way to work around it.
Thanks in advance.
Turns out Max was on the right track - if I manually specify a non-distribution provisioning profile it will work properly by overriding the Testflight version of the app (the orange dot disappears). Not sure why "automatic" wasn't doing that for me. Thank you!

Restore the connection to iPhone and run watchkitextension again

I am using Xcode 6.3 and I keep getting the following message even if my phone and watch are both connected (and not locked):
Restore the connection to "mm24’s iPhone" and run
"com.projectname.watchkitextension" again, or if
"com.projectname.watchkitextension" is still running, you can attach
to it by selecting Debug > Attach to Process >
com.projectname.watchkitextension.
Even if I reset Xcode, Watch or phone I still get the above. The app seems to install on the devices but the connection with Xcode is not there.
Any suggestion on how to fix this?
I was running into this issue as well and it seems like I was able to solve it by removing the armv7 attribute of Valid Architectures on the WatchKitApp target And the WatchKit extension target.
See this apple forum post for more info on it.
This was driving me crazy for about a day and half, but seems to consistently let me build onto my watch for the last 2 hours.

Xcode 6 process launch failed: timed out trying to launch app

I can't debug my app because when I run it, Xcode gives me the error:
Process launch failed: timed out trying to launch app
In the device I see a black screen and after the error message the app starts.
How can I fix this?
I tried to change the code signing identity and the provisioning profile, and to refresh the provisioning profiles in the Xcode > Preferences > Accounts > Details tab.
I'm using Xcode Version 6.0.1 (6A317) with an iPad mini, running iOS 8.0 and a MacBook with OSX 10.9.4.
After this, if the iPad goes into sleep mode (the screen turns off) I can't wake it anymore; I have to do a soft reset.
You are using distribution provisioning profile rather than development profile. check this link
How to Fix:
I fix it with:
clean project (Product > Clean)
hard reset device (power button + home button)
delete app from device
close xcode
CLOSE ITUNES (itunes must be closed)
re-open Xcode and run!
I think that iTunes was the problem.
EDIT: 2017/02: Solution still Woks (Thanks to #SalGad for information).
I am using Xcode 6.2, running on iPhone 4 with iOS 7.1.2, the problems happen to me as well.
It turned out that the Project and Targets' Code Signing settings are different from each other! And that's what is causing the issue.
To solve the issue, you must make sure that their Code Signing settings is the same.
One more thing that may be a reason to launch timeout arising is that you have a lot of Provision Profiles on your device. I have about 100 of them, downloaded automatically by XCode from our team dev portal. So if your team have tons of apps and Provision Profiles, you better unlink your XCode from your Apple ID, to prevent automatic downloading for unwanted PPs. It significantly decreases app launching time.
To delete unwanted PPs from your device you have to go XCode - Window - Devices, select your device and click "Show provision profiles..." on the bottom context menu. Then you have to manually remove the profiles. Tip: use key sequences "down arrow" - "backspace", to ease the hand routine.
I had this but nothing previously posted seemed to work. This is what I did to fix the issue in Xcode 6.3.2:
Go to Product->Scheme->Edit Scheme...
Select the Run Scheme
Select the Info tab
Make sure the settings are as follows:
Build Configuration is set to "Debug"
Debug Executable is checked
Launch Automatically is checked
In my case I was using the development profile, but somehow, in Build Settings > Code Signing, the Provisioning Profile for Debug was empty.
But before setting it to "iOS Team Provisioning Profile", I had to reset my account since it said " is Not on Any Development teams"
- Xcode > Preferences > Accounts
- Remove my account (click "-")
- Add the account again
That fixed the problem
Note that if the app still manages to start on the device after Xcode displays this error, you can attach to the running process with Debug->Attach to Process.
This warning is shown when you try to run and debug your code directly in device but you are using distribution profile in your Build Settings.
To directly run the code in device and debug, you need to use development profile in your Build Settings of Xcode.
After setting the development profile, just reboot your device clean your Xcode project and run again.
I hope this helps !!
An app should return from his initialisation procedure in less then 10 seconds, or it will be killed by the OS. This is probably because you are doing too many things in the startup phase.
Try to refactor your code to do it diffrently, by doing lazy initialisation, and only initialize what is really important before showing the first view.
It's hard to give better advice before knowing more about the app itself
I have faced this issue with Xcode 6.2 and Iphone 5s with iOS version 8.3.
I get this message when I deploy the application to the device for the first time.
The work around I found was that with out unintalling the application from the device,redeploy the application from Xcode.It should run perfectly this time.
I observed this only on Xcode 6.2 not on Xcode 6.3 so this might be an Xcode to iOS version compatibility issue.
Big and weird tip for this problem... this was happening to me and none of the advice helped anywhere on the web, but then i noticed if i deleted everything out of the main ViewDidLoad method it would work. I realized there was one line of code that was messing it up. It was a line that was referencing to an array of strings that was way to big. I had something like this NSString *mystring[100][1000][100]; i accidentally added some zeros and for whatever reason this problem produced the same error message that the incorrect signing gives you. So don't let your arrays or matrixes get too out of hand!
Method #1:
Lock your phone, press XCode start, wait till XCode says "unlock your device to launch", then unlock your phone, it will be launched successfully, works every time.
Method #2:
If your goal is just to debug the app, here is another simple and straight-forward approach:
After the app is deployed, launch it manually.
Goto XCode -> Debug -> Attach to Process ... to choose your app from the list, then debug properly.
This works well for me, and it saves lots of time.
I hope this helps, thanks!

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