简体   繁体   中英

iOS Push Notification Shows up as UIAlert when App is Running

I have push notifications successfully set up on my app. When I send a push to a user when they are not running the app they receive it banner-style as they should.

However, when a user has the app open, instead of displaying the push notification as a banner it shows up as a UIAlert. Receiving pushes only behaves this way when the app is open.

I have the "Alert Style When Unlocked" set up as "Banner" (on both phones), and this behavior persists.

When Applicationn is running you will get call in didReceiveRemoteNotification method on AppDelegate Class , so now you can handle notification here :

Now You can create a custom view and add it to your application main window as a banner.

The settings is for App in background, show as Banner or Alert. When App is opened it calls didReceiveRemoteNotification directly, and no Banner or Alert show up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM