Changes

Jump to: navigation, search

Building an Example WatchKit App

1,852 bytes added, 19:58, 27 April 2015
Setting the Scene Title and Key Color
By default Xcode will launch the 42mm Apple Watch simulator. To also test the layout on the 38mm Apple Watch model, select the iOS Simulator Hardware -> External Displays -> Apple Watch – 38 mm menu option and then stop and restart the WatchKit app from within Xcode.
 
== Running the App on a Physical Apple Watch Device ==
 
In order to test the app on a physical Apple Watch device, connect the iPhone with which the Apple Watch is paired to the development system and select it as the target device within the Xcode toolbar panel (Figure 3-14).
 
[[Image:watchkit_select_device.png|Selecting a physical iPhone as the run target]]
 
Figure 3-14
 
 
With WatchKitSample WatchKit App still selected as the run target, click on the run button and wait for the app icon to appear on the Apple Watch home screen. Once the icon appears, tap on it to launch the app.
Depending on the version of Xcode that you are using, the following error may occur when attempting to run the app on a watch device:
 
<pre>
Embedded Binary Validation Utility error: WatchKit apps must have a deployment target equal to iOS 8.2 (was 8.3).
</pre>
 
If this error appears in Xcode, select the WatchKitSample target entry at the top of the Project Navigator panel to display the target settings. Within the settings panel, select the Build Settings screen as highlighted in
Figure 3-15:
 
 
[[Image:watchkit_build_settings.png|Xcode build settings]]
 
Figure 3-15
 
 
By default, the build settings for the iOS app will be displayed. Using the menu in the upper left hand corner of the settings panel (indicated by the arrow in Figure 3 15 above), select the WatchKitSample WatchKit App option as highlighted in Figure 3-16:
 
 
[[Image:watchkit_app_settings.png|Selecting the WatchKit app target]]
Figure 3-16
 
 
With the WatchKit app build settings displayed, enter iOS Deployment Target into the search box and change the deployment target settings to iOS 8.2:
 
 
[[Image:watchkit_deployment_target.png|Setting the iOS deployment target]]
Figure 3-17
 
 
Having changed the deployment target the app should compile and run on the Apple Watch device.
 
== Setting the Scene Title and Key Color ==

Navigation menu