Just My Life & My Work

三年前(2015年)幫公司製作比特幣查詢用的Watch App,已有開發經驗遇過一些坑,照理說能馬上迎刃而解才是,不過大腦卻沒能及時反應,只好上網打關鍵字求解!

watch apps

問題:

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:

  1. iOS
  2. WatchKit App
  3. 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.

[iOS][watchOS] Watch App三個ID設定.png

The WKAppBundleIdentifier identifier must match with the WatchKit app bundle identifier like this:

WKAppBundleIdentifier: com.happy.watch.watchkit

這樣一來,專案終於能編譯到Apple Watch上囉~

參考:WatchKit Extension bundle identifiers

廣告

Comments on: "[iOS][watchOS] Watch App三個ID設定" (1)

  1. […] 接著隨意創立一個專案,並加入Watch App的Target。一共需要3個ID,可參考先前文章:Watch App三個ID設定。 […]

隨意留個言吧:)~

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

標籤雲

%d 位部落客按了讚: