三年前(2015年)幫公司製作比特幣查詢用的Watch App,已有開發經驗遇過一些坑,照理說能馬上迎刃而解才是,不過大腦卻沒能及時反應,只好上網打關鍵字求解!
問題:
error: WatchKit Extension doesn’t contain any WatchKit apps whose bundle identifiers match “com.happy.watch.watchkit". Verify that the value of WKAppBundleIdentifier in your WatchKit Extension’s Info.plist matches the value of CFBundleIdentifier in your WatchKit App’s Info.plist.
想開發Watch App,需要申請三個ID:
- iOS
- WatchKit App
- WatchKit Extension
這三個ID逐一依賴,怎麼說?3依賴2,2依賴1,缺一不可哪~
命名相當有技巧,所以只要搞定一次,之後依樣畫葫蘆即可!
解法:
iPhone Application Info.plist:
Set any bundle identifier as you like (the “Bundle identifier" property).
Example:
Bundle identifier: com.happy.watch
WatchKit App Info.plist
The bundle identifier here must be prefixed with the identifier of the iPhone application, like this(example):
Bundle identifier: com.happy.watch.watchkit
You also need to change the WKCompanionAppBundleIdentifier which must match with the iPhone application bundle identifier, like this:
WKCompanionAppBundleIdentifier: com.happy.watch
Watchkit Extension Info.plist:
The bundle identifier here must be prefixed with the identifier of the iPhone application, like this(example):
Bundle identifier: com.happy.watch.watchkit.extension
You also need to set the WKAppBundleIdentifier under the NSExtension attribute.
The WKAppBundleIdentifier identifier must match with the WatchKit app bundle identifier like this:
WKAppBundleIdentifier: com.happy.watch.watchkit
這樣一來,專案終於能編譯到Apple Watch上囉~
Comments on: "[iOS][watchOS] Watch App三個ID設定" (1)
[…] 接著隨意創立一個專案,並加入Watch App的Target。一共需要3個ID,可參考先前文章:Watch App三個ID設定。 […]
讚讚