Thursday, May 7, 2015

I Just Want to Run my Watch App in the Simulator!

I spent the better part of a day and a half trying to add a Watch app to an existing iOS 7 project and run it in the simulator, but ran into two primary problems. First, the repeated appearance of the SPErrorInvalidBundleNoGizmoBinaryMessage error and second, the “Waiting to attach” message in the Xcode Debug Navigator. This seems to be happening to lots of others as well. Let me outline what worked for me in the hopes that it saves you from spending as much time as I did on this.

Note that this pertains to using Xcode 6.3 with an iOS project having a deployment target of iOS 7.0. If your situation is different, this may not help you at all.
  1. Select the project target of your iOS app. Go to the General tab. Make note of the version and build values there.  Select your WatchKit Extension target and your WatchKit App target and set them to be the exact same values as the iOS app. If the version is 1.2, set the version for all three targets to be 1.2, If the build is 32, set the build for all three targets to be 32.
  2. Select the project target of your iOS app. Go to the General tab. Make note of the team setting. Select your WatchKit Extension target and your WatchKit App target and set them to be the exact same value as the iOS app.
  3. Select the project target of your WatchKit App – NOT the iOS app, NOT the WatchKit Extension. Got to the Build Settings tab. Find the iOS Deployment Target setting. Set that to be iOS 8.2. I’m not clear on the reasons, but it CANNOT be iOS 8.3. The extension can be set to 8.3, but not the app.
  4. Select the project target of your WatchKit Extension and then your WatchKit App. Both of mine showed warnings for my provisioning profile. In my previous attempts to get to this point, I had created new App IDs using the bundle identifiers Xcode created in the Member Center. Xcode then created provisioning profiles on its own. I would suggest you create the App IDs, got to the Build Settings tab and set your Provisioning Profile to be Automatic, quit Xcode, re-launch Xcode, open the project, build, and hope that this voodoo dance gets you what you need. You may need to refresh provisioning profiles Xcode has, but I did not. 
Now, at this point I could run the iPhone 6 8.3 simulator and see the time and charging icon in the top-right corner of the Watch simulator. BUT, if I switched to one of the 8.2 simulators, specifically the iPhone5s 8.2 simulator in my case, THEN I started to see the “Waiting to attach” message in the Xcode Debug Navigator, where it sits indefinitely.

To recover from this problem, sometimes I had to reset the simulator and do a deep clean (Cmd + Shift + Option + K) and sometimes I just needed to switch back to the iPhone 6 8.3 simulator.

I honestly don’t know what new issues will come up as I try to test on a real device, but this at least got me to the simulator.