Description
Issue about warning message on console
Right now iOS apps have the following in their logs:
You've implemented -[ application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
A possible improvement would be to avoid implementing that method directly, and instead only add an implementation using class_addMethod
if we detect that it's needed for registered plugins. If no plugin implements application:didReceiveRemoteNotification:fetchCompletionHandler:
then FlutterAppDelegate
wouldn't implement it either, and thus would avoid the warning.
The same could be done for other UIApplicationDelegate
methods as well.
/cc @mravn-google @szakarias @jakobr-google @mit-mit @Hixie @goderbauer
Edited by cyanglaz:
The original issue mentioned above has been fixed with flutter/engine#8843. However, there is a related but different issue regarding receiving email warning from Apple when uploading builds. I have summarized the discussions and works related to it in below section for easier understanding the bug and where we are at:
Issue about warning email from Apple
When uploading a Flutter App to Apple, one might receive an warning Email like below:
Dear Developer,We identified one or more issues with a recent delivery for your app, "Flutter Gallery". Your delivery was successful, but you may wish to correct the following issues in your next delivery: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 8 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 use Xcode or Application Loader to upload a new binary to iTunes Connect.Best regards,The App Store Team
Although this warning doesn't block releasing Apps, this warning is annoying and confusing for Flutter Apps that doesn't use push notifications.
Steps to reproduce
- You need to have a valid Apple Distribution certs and private keys installed on your computer.
- Create a new Flutter App. Build it for iOS with
flutter build ios
, orflutter build ios --local-engine=ios_release
local engine build. - With the Apple Distribution account, upload the App to App Store Connect. You can follow the steps here: https://help.apple.com/xcode/mac/current/#/dev442d7f2ca
- After a successful upload, you will see an email with a message similar to above.
Workaround
To not receiving this email anymore, you can workaround by enabling publish notification in your App. (You don't have to implement any publish notification features, just simply enable the feature and capability will suppress the warning.)
Cause
The root cause of this issue is the appearance of [application:didRegisterForRemoteNotificationsWithDeviceToken:] in the engine code base is the cause of the email warning in #9984 (comment).
Either directly implement this method, or dynamically implement this method with a similar solution in flutter/engine#8843 (which only mentioning this method with a @selector syntax) triggers this warning email.