No complication configuration in xcode for watchOS 9 - ios

I added a new watch app for an existing iOS App that is build with react native. I never developed a watch app before. I read everywhere that this should create two targets, the watch App and the App extension. But only a watch app gets created.
Now I want to add a complication for this watch app. I tried to follow the steps here and here. It says that on the general tab of the extension (which is not present in my project) I should configure the Complication Configuration. But this option is just not present.
Was this changed with watchOS 9 or am I missing something else?

I’m having a similar issue after creating a watchOS app in Xcode 13 without an initial complication. Fortunately, I was able to work around the missing configuration UI by manually setting the values.
Assuming you’ve followed these steps of creating the ComplicationController class and “Complication” placeholder in Assets,
Go to Project -> watch app target -> Build Settings
Set “Complication Principal Class” to $(PRODUCT_MODULE_NAME).ComplicationController under Info.plist Values
Set “Watch Complication Name” to Complication under Asset Catalog Compiler - Options

Related

iOS custom keyboard settings not saving

I’m implementing a settings bundle for a custom keyboard using the Apple Keyboard Extension documentation and the settings tutorial it links to.
This method works in the parent app, but when I implement it as identically as possible for the keyboard extension, the settings bundle does not appear to save any of the data, as shown in this video. It seems as if something is resetting the values near-constantly: any time I exit the settings view (e.g. Multitasking view, previous settings page), the values are set to zero (not default: empty, false, and zero respectively). This is the default settings bundle template, no edits, not referred to in code.
Is there a special implementation for extension settings not explicitly stated in the documentation (or that I missed) that is causing this?
For clarity, the steps I took (after creating the extension):
Created the bundle with New File –> Settings Bundle.
Named it, targeted the keyboard extension.
Built and ran.
These were the same steps I took for the parent app (targeting the app), which was able to save settings.
This is on a physical iOS 11.0 (15A5326a) device; app built with Xcode 9.0 (9M202q), Swift 4.

User-Defined settings for WatchKit

I am using User-Defined settings (for example CustomAppBundleId) to change bundle identifier for different configurations. In the app’s plist file I set CFBundleIdentifier to ${CustomAppBundleId}. For Release configuration I use bundle:
com.yourcompany.${PRODUCT_NAME:rfc1034identifier}
and for AdHoc I use:
com.yourcompany.adhoc.${PRODUCT_NAME:rfc1034identifier}
Now I added WatchKit Extension and WatchKit App. For WatchKit Extension bundle identifier I can use the same approach. I also have to change WKAppBundleIdentifier to match the bundle identifier in the WatchKit App. Again, I could use User-Defined settings. Now the last bit is WatchKit App. Unfortunately WatchKit App doesn’t have an option to add User-Defined settings but I need to set the right values for CFBundleIdentifier and WKCompanionAppBundleIdentifier (that is equal to CustomAppBundleId in the app). Is there any way I can do it? Or should I use different approach?
Define your "User-Defined" variables in project's Build Settings rather than in target's. That way you will have the same user defined variables automatically available (inherited) in WatchKit Extension and App target.
Btw make sure you have the latest Xcode 6.3 from the App Store. This version (and most recent Xcode 6.3 beta 4) already allow you to define custom "User-Defined" in Build Settings).
Previous versions were simply missing "Build Settings" tab in WatchKit App target, but if you were brave enough, you could have modify those manually in plain text editor :-)
Update to Xcode 6.3.
In 6.3 you will have additional tabs for target configuration that should provide what you need.
But I'm almost sure you will face issues with the WatchKit App Storyboard.
In the Scenes > Identity Inspector > Custom Class you have to set the correct module - that is not possible if you have more than 1 (if you do not have more than one I would be more than interested in your setup)
I solved that issue with a pre-action script that updates the storyboard XML accordingly

Apple Watchkit simulator issue: SPErrorInvalidBundleNoGizmoBinaryMessage

When I open my existing Watchkit app (Xcode 6.2), it compiles correctly, the simulators are launched (iPhone+Watch), followed by the meaningful error:
Error Launching 'xxx Watchkit Extension'
SPErrorInValidBundleNoGizmoBinaryMessage
I have this issue with all simulators (iPhone 5/5S/6/6+ - 38mm/42mm)
Any ideas what the issue can be?
It seems for some reason the application does not want to run on the simulator, even though it used to. The iPhone application included in the same project does run, as do other Watchkit sample applications.
Did you change the bundle ID of your app? If so you may need to manually update the WKAppBundleIdentifier in the WatchKit Extension and also the WKCompanionAppBundleIdentifier in the WatchKit App.
WKAppBundleIdentifier may need to be same to WatchKit App's Bundle Identifier.
Please check WatchKit Extension's info.plist.
NSExtension - NSExtensionAttributes - WKAppBundleIdentifier - xxxxx.watchkitapp
EDIT: Further explanation to clarify...
Under your App target you go to INFO tab and set Bundle Identifier to com.myapp
Then under the WatchKit Extension target you go to INFO tab and set the Bundle Identifier to com.myapp.watchkitextension
Then still under the WatchKit Extension target and still under the INFO tab you set NSExtension > NSExtensionAttributes > WKAppBundleIdentifier to com.myapp.watchkitapp
So one ends with .watchkitextension and the other ends with .watchkitapp
Check Info.plist for "Your App WatchKit Extension" & "Your App WatchKit App". First part of all indentifiers should be same.
In my case problem was in "Your App WatchKit Extension" > NSExtension > NSExtensionAttributes > WKAppBundleIdentifier.
Be sure you are using an 8.3 simulator.
I got this message consistently when using 8.2. Tried everything listed here and struggled with this for hours. Switching to 8.3 resolved it. Ironic, since you must set the deployment target to 8.2 at the moment, but watchkit apps need 8.3 to run I guess...
I checked all bundle identifiers multiple times but couldn't get rid of the issue. Neither did cleaning the build folder work out.
However, I was able to sort it out by turning off Game Center at the Capabilities of my WatchKit Extension.
Turning it on for the iOS host app seems to work fine, but turning it on for the WatchKit Extension results in the SPErrorInvalidBundleNoGizmoBinaryMessage error when attempting to run the WatchKit App in the simulator, while it completes building without any complaints.
I'm developing a game for Apple Watch and was looking forward to support Game Center. It was actually my plan from the very beginning to communicate with the hosting iOS app to do so, but then I saw Game Center listed in the Capabilities of the WatchKit Extension itself, so I expected to be able to deal with it right there. However, as it doesn't seem to work, I'm going to stick to my original plan to support it through the hosting iOS app.
Xcode Version 6.2 (6C131e)
EDIT: Same issue with Xcode Version 6.3 (6D570)
For issues on real devices (not simulator), do everything in this post:
http://blog.jaredsinclair.com/post/117350678170/jareds-code-signing-tips-apple-watch-edition
Most importantly:
All three targets require the following:
a unique app ID for that target a code signing identity (applies to
all targets) a unique provisioning profile for that target.
and make sure that the app ID's are consistent:
Your app IDs will look something like this:
com.company.App-Name
com.company.App-Name.todaywidget
com.company.App-Name.watchkitapp
com.company.App-Name.watchkitextension
If it still doesn't work, manually delete the app from the watch (by holding onto the icon and then hit 'x') and then try again. This was the kicker that did it for me.
The procedure I solved the problem is
Check if WKAppBundleIdentifier and bundle identifier in WatchKit extension and WatchKit App are correct
Delete subfolders of ~/Library/Developer/CoreSimulator/Devices
Delete subfolders of ~/Library/Developer/Xcode/DerivedData
Clean my project
Restart simulator
Run
I've been struggling with this as well. This is what solved my problem on Xcode 7.1 iOS 9.
Just Make sure you follow the naming below for your identifiers:
Target - com.myCompany.myApp
Watchkit app - com.myCompany.myApp.watchkitApp
Watchkit extension -
com.myCompany.myApp.watchkitApp.watchkitextension
The extension should have the identifier of the WatchKit app target + .watchkitextension
I've tried everything posted thus far in this thread but still couldn't get it to work. I resorted to backtrack to the point when it was working and retrace every single action that I've done to figure out at which point it breaks...
As it turned out, the WatchKit App's info.plist file does not like any custom plist entry, at least that is what I've found out in my case. I've added an entry called "MyAppBundlePrefix" and it caused the "Error Launching 'xxx Watchkit Extension' SPErrorInValidBundleNoGizmoBinaryMessage"
I wish XCode would offer a little bit more specific detail for that error but it took me about 5 hours to find it out by brute force way.

Apple watch simulator issue

I am trying to debug and run the app on apple watch simulator. I have tried by using different target for notification, Glance and Watch app but apple simulator don't shows any thing.. It stuck in waiting for attach process of extension. I just see a black screen for the Apple Watch Simulator.
What did I do wrong?
How to overcome this issue ?
This post from the dev forums solved my issue. More specifically, this excerpt:
In order for Watch apps to function properly, certain properties
must match across the Watch app and its App Extension (18857540):
The WKAppBundleIdentifier property of NSExtensionAttributes in the WatchKit App Extension’s Info.plist must match the
CFBundleIdentifier of WatchKit App's Info.plist.
The WKCompanionAppBundleIdentifier property of the WatchKit App's Info.plist must match the CFBundleIdentifier of the Containing iOS App's Info.plist.
I have exactly same problem. I created a new project and added WatchKit extension in Xcode 6.2 beta 4 with WatchKit. I tried all ways mentioned in other answers but still failed to let watch app run in the simulator. Finally, I made it work.
My steps:
Delete the containing app in the iPhone simulator.
Clean your project in Xcode.
Do not run the containing app, run the WatchKit app from Xcode.
I had the same issue. The only thing that helped was to delete and recreate the target scheme.
Before spending a lot of time on changing things, restart Xcode. Sometimes, this solves the problem.
Even if everything is configured correctly, it may take 20 seconds to attach the process to the debugger.
You need to run the Watch App target and then from iPhone/iPad simulator check (Hardware -> External displays), any one of the Apple Watch options.
I was experiencing the same issue. Mainly when creating an app extension in an existing app.
I was able to consistenly solve it by doing the following steps:
Make sure that the app extension gets the .appex extension. XCode tends to set it to .app. You can do this under 'build settings' -> 'wrapper'.
Under the 'Build Phases' tab in your target, your app extension should be listed under 'Embed App Extensions'. If you don't see this section, you can enforce it by adding a normal app extension to your app (fe. action extension). The section will now be visible. Replace the dummy extension you just created with the Watch app extension.
Start the host app and then start the Watch app, it should be working now.
I had some trouble on iPhone 6 simulator, but each time I switch on iPhone5S it works.
In my case the trouble was caused by a scheme with missing target although not the one I was trying to run.
Hope that helps somebody.
I was running into this problem as well and tried a few of the suggestions above. I found that deleting and recreating the target scheme resolved it. Everything is working fine now.

Can't run Lister app sample code (Swift) from Apple's website

I tried to download and run the Lister app sample code which was presented at WWDC for the session 406: Integrating Swift With Objective-C. (I am running XCode 6.1 on Yosemite and this is the most updated version of the Lister app from the sample code page in Apple).
https://developer.apple.com/library/ios/samplecode/Lister/Introduction/Intro.html
However I was unable to run the app in XCode which are best show in the attached screenshot.
The app doesn't have the Run and Stop buttons enabled. They are greyed out. Never had this before for any other app.
The icons for the Lister app is not showing. Instead there is this new Settings-like icon which I have never seen and have no idea what it means.
There is a ReadMe.txt file in the project that you downloaded. Have you read it because I had the same problem and by reading it, my problems were solved.
Regards
The QuickStart guide included in the project gives the key setting to change in the Build Settings to enable iCloud.
In the User-Defined section, double-click on com.example.apple-
samplecode to edit the LISTER_BUNDLE_PREFIX value.
Change this prefix to a globally unique reverse DNS string for your own
organization’s name, such as com.somecompany.lister.

Resources