I've set up the push notification service extension in xCode.
I've set target Deployment version to 13.0 (app is 13.0 as well)
Info.plist of an extension has correct NSExtensionPrincipalClass
To test, I'm running extension target and selecting app
I'm testing everything on a device that's running iOS 14.2
I've tried following payload:
{
"gcm.message_id" : "XXXXX",
"type" : "XXXXX",
"url" : "XXXXX",
"body" : "XXXX",
"title" : "XXX",
"google.c.a.e" : "XX",
"aps" : {
"mutable-content" : 1,
"alert" : {
"title" : "Test",
"body" : "Test"
},
"category" : "XXXX",
"content-available" : 1
},
"channel_id" : "XXXX"
}
I also tried excluding mutable-content but service extension still didn't get called.
I also tried with simpler payload like this:
{
"aps" : {
"mutable-content" : 1,
"alert" : {
"title" : "Test",
"body" : "Test"
},
"category" : "XXXX",
"content-available" : 1
}
}
No luck here either, both with and without mutable-content
I can always see a push notification as a result of testing but the breakpoint in extension `didReceive` method is not triggered. Also the payload is not modified in any way.
Methods like restating device, restarting macbook and deleting derived data didn't work as well
I managed to solve this buy deselecting Copy only when installing in app target -> Build Phases -> Embed App Extensions
Related
i've developed crossplatform app using flutter with firebase_message plugin.
it works well in android system but push notification does not work in IOS partially
when i try to send push notification from firebase console web to all of IOS devices, it works well
but if i try to send using POST method with
<header start>
Authorization : <Firebase server key>
<header end>
{
"collapse_key" : "type_a",
"priority" : "high",
"notification" : {
"body" : "bd",
"title": "tt",
"android_channel_id": "noti_push_NEW_PLAY"
"sound": "NEW_MESSAGE.wav"
},
"data" : {
"click_action": "FLUTTER_NOTIFICATION_CLICK"
"type": "NEW_MESSAGE",
},
"apns": {
"payload": {
"aps": {
"sound": "NEW_MESSAGE.wav",
}
}
},
"to" : <token>,
}
push notificaion does not works in IOS with error NotRegistered
{
"multicast_id": <returned id>,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "NotRegistered"
}
]
}
i don't think it is related with settings, because i can send push message to all IOS devices from firebase web console. but if i try to send it tor specific device, i can't.
i followed all step firebase setup, APN certificate, Apple id, Adding Xcode push notification capablity, etc...
what's the problem???
thanks
I've just resolved it to add
FirebaseAppDelegateProxyEnabled = YES
in info.plist
Not Receiving push notifications from firebase
We are using Firebase for sending remote push notifications, we are in need to grouping received notification like WhatsApp (Ex: 25 new messages received). I have tried it by adding APNs in JSON, but it's not working. Here is my tried code:
{
"to" : "**FCM TOKEN**",
"priority" : "high",
"notification" :
{
"title" : "You have a new message",
"body" : "Test",
"badge" : 1
},
"apns":
{
"headers":
{
"apns-collapse-id":"***APNs ID***"
}
}
}
I'm receiving notification but not able to grouping it.apns-collapse-id which was taken from developer.apple.com.
Coding iOS app in react-native (0.35.0) and using iPad mini (9.3.5) as a test device. Already made Android app with successfully implementing react-native-fcm module for notifications.
Problem I'm facing now in iOS development is that I do receive notification while app is in background but I do not get it in notif center (I can just catch it in console). I have no idea why is it happening.
This is the module I'm using react-native-fcm . I've followed all the instructions in Cocoapods and in manual integration but I can't make it work. I get no errors what so ever. Tried by directly pushing app to device trough xCode and by archiving it (thought that it might be bundling problem).
Any help would be highly appreciated (even though if someone hasn't worked in react-native but ran into this problem in for example swift). If needed I can provide more information.
Best regards,
Bepo.
EDIT:
I'm sending this JSON:
{
"notification" : {
"body" : "Notif body",
"title" : "notif",
"icon" : "myicon",
"sound" : "default",
"vibrate": "default",
"extra" : "Some extra I need"
},
"data" :{
"redirectUrl" : "Url that I need to redirect person after it clicks on notif"
},
"to" : "token that I've gotten",
"content_available": true,
"priority" : "high",
"show_in_foreground": true
}
with headers:
Content-Type:application/json
Authorization:key= my Api key on firebase
FCM response:
{
"multicast_id": ***************45844,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:********************a1027b"
}
]
}
Notification i'm catching in console:
{ notification:
{ title: 'notif',
sound: 'default',
vibrate: 'default',
icon: 'myicon',
extra: 'Some extra I need',
sound2: 'default',
e: '1',
body: 'Notif body' },
redirectUrl: 'Url that I need to redirect person after it clicks on notif',
collapse_key: 'My app id',
opened_from_tray: 0,
from: '*********' }
I had added app analytic for such events in my application which
perfectly works with iOS Simulator, but not with iOS device
When I run it on iOS Simulator, it gives me below log
Events: [
{
"event" : {
"_eventName" : "XXX",
"_logTime" : 1446626494,
"User ID" : "159",
},
"isImplicit" : false
}
]
Flush Result : Success
When I run it on iOS device, it gives me below log
Events: [
{
"event" : {
"_eventName" : "XXX",
"_logTime" : 1446626494,
"User ID" : "159",
},
"isImplicit" : false
}
]
Flush Result : No Connectivity
Please help me if anyone know issue.
Make sure that you are logged in with Developer Facebook ID in that
iOS device from which you had generated Facebook App ID.
How to hide push notification in ios? I need to convert push notification to local notification. what should be the structure of payload for this?
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
You can refer the above link to Know about the payload of push notification.
For not showing push notification you need to pass the payload without alert. If you want a silent notification set Content-available as 1. It'll help.
Eg:
{"aps" : {
"content-available" : 1
},
"YourData":""
}
structure of payload for hide the push notification is..
This Show notification
{
"aps" : {
"alert" : "Message received from Bob"
"badge" : 5,
},
"acme1" : "bar",
"acme2" : [ "bang", "whiz" ]
}
This one hide your notification
{
"aps" : {
"badge" : 5,
},
"acme1" : "bar",
"acme2" : [ "bang", "whiz" ]
}