iOS और डेटा संदेश के साथ कोई समस्या है। इसमें कहा गया है कि here
iOS पर, FCM संदेश संग्रहीत करता है और यह बचाता है केवल जब एप्लिकेशन को अग्रभूमि में है और एक FCM कनेक्शन स्थापित किया।
तो वहां एक काम होना चाहिए। कुछ मेरा के समान:
संदेश 2 पुश नोटिफिकेशन:
1) सामान्य उपयोगकर्ताओं को जगाने के लिए फोन/आरंभ एप्लिकेशन इस कोड का उपयोग पृष्ठभूमि में है:
{
"to" : "/topics/yourTopicName",
"notification" : {
"priority" : "Normal",
"body" : "Notification Body like: Hey! There something new in the app!",
"title" : "Your App Title (for example)",
"sound" : "Default",
"icon" : "thisIsOptional"
}
}
2) डेटा अधिसूचना जो उपयोगकर्ता को ऐप खोलने पर ट्रिगर करेगी
{
"to" : "/topics/yourTopicName",
"data" : {
"yourData" : "1",
"someMoreOfYourData" : "This is somehow the only workaround I've come up with."
}
}
और, इसलिए, - (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage
विधि के तहत अपने डेटा को संभाल:,
- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
// Print full message
NSLog(@"%@", remoteMessage.appData);
//
//*** ABOUT remoteMessage.appData ***//
// remoteMessage.appData is a Key:Value dictionary
// (data you sent with second/data notification)
// so it's up to you what will it be and how will the
// app respond when it comes to foreground.
}
मैं भी (स्थानीय सूचना बनाएं) ऐप्लिकेशन के अंदर सूचना उत्प्रेरित करने के लिए इस कोड को छोड़ देंगे क्योंकि आप इसका इस्तेमाल एक बना सकते हैं खामोश बैनर, हो सकता है, तो उपयोगकर्ता फिर से अधिसूचित हो जाता है तब भी जब एप्लिकेशन को अग्रभाग में आता है:
NSDictionary *userInfo = remoteMessage.appData;
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.userInfo = userInfo;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.alertBody = userInfo[@"yourBodyKey"];
localNotification.alertTitle = userInfo[@"yourTitleKey"];
localNotification.fireDate = [NSDate date];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
यह अधिसूचना एक ही दूसरे एप्लिकेशन को अग्रभूमि में आता है ट्रिगर किया जाएगा।
संभावित डुप्लिकेट [ऐप से बाहर होने पर एपीएन प्राप्त नहीं करना] (http://stackoverflow.com/questions/40295475/not-receiving-apns-when-out-of-app) – Chris
प्रश्न जो आपने मुझे संदर्भित किया कोई जवाब नहीं है और अलग-अलग वाक्यांश है। –