(圖說:振翅滑翔的臺灣藍鵲 (Formosan Blue Magpie),為臺灣特有種鳥類。圖片來源:Wikipedia。)
描述
我們某個團隊使用 Flutter 開發的應用程式送上 App Store Connect 之後,每個 build 都會收到一封來自 App Store Connect 的通知信件,標題為:“App Store Connect: Your app "{appName}" (Apple ID: {id} Version: {version} Build: {build}) has one or more issues”。
內容大綱
這封信件的內容是這樣的:缺少了個「Push Notification Entitlement」。
Dear Developer,
We identified one or more issues with a recent delivery for your app,
"{appName}" {version} ({build}). Your delivery was successful, but you
may wish to correct the following issues in your next delivery:
ITMS-90078: Missing Push Notification Entitlement - Your app appears
to register with the Apple Push Notification service, but the app
signature's entitlements do not include the 'aps-environment' entitlement.
If your app uses the Apple Push Notification service, make sure your
App ID is enabled for Push Notification in the Provisioning Portal,
and resubmit after signing your app with a Distribution provisioning
profile that includes the 'aps-environment' entitlement. Xcode does not
automatically copy the aps-environment entitlement from provisioning
profiles at build time. This behavior is intentional. To use this
entitlement, either enable Push Notifications in the project editor's
Capabilities pane, or manually add the entitlement to your entitlements
file. For more information, see https://developer.apple.com/library/
content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/
HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1.
After you’ve corrected the issues, you can upload a new binary to
App Store Connect.
Best regards,
The App Store Team
我們這個應用程式沒有使用到 push notification 功能,但是 Flutter 有使用 UIApplicationDelegate
callback (source)。App Store Connect 沒有拒絕這個應用程式的發布。所以這是個警告訊息 (warning),不是個錯誤訊息 (error)。有些人也許會想要繼續忽略亦可。
解方
如果你也想要(某種程度地)解掉這個警告訊息,以下是我們找到的 workaround:
- 在 XCode 裡頭開啟 Flutter 專案 (Runner) 。
- 在 Capabilities 分頁加入啟用 "Push Notifications"。(請參考下方螢幕截圖)
- XCode 將會自動產生 “ios/Runner/Runner.entitlements” 檔案。
- 完工。
如果這個分享對你有幫助,歡迎拍打餵食一杯咖啡 ☕ :)
參考
- “ios/Runner/Runner.entitlements” 檔案內容 (由 XCode 產生):
|
|
- 另外,我手邊時不時會有 Flutter 專案冒出來,歡迎有興趣一起邊玩 Flutter、邊做有趣專案的朋友傳訊息給我 Twitter @dwchiang。