में OneSignal के साथ शिकायत भाषा सामग्री मेरी पुश नोटिफिकेशन प्रबंधित करने के लिए मैं OneSignal का उपयोग कर रहा हूं। कुछ सूचनाओं के लिए, मैं प्राप्त कर रहा हूँ:कैसे हल करें: स्विफ्ट
सूचनाएं अंग्रेजी भाषा सामग्री
होना आवश्यक है लेकिन मैं केवल अंग्रेजी भाषा में सब कुछ भेजने हूँ ...
oneSignal.postNotification(["headings" : ["en": "\(who)"],
"subtitle" : ["en": "\(subtitle)"],
"contents" : ["en": "\(contents)"],
"include_player_ids": [result]],
कौन, उपशीर्षक, सामग्री स्ट्रिंग्स हैं, परिणाम रिसीवर आईडी है। अधिकांश अधिसूचनाएं भेजी जाती हैं, कुछ के लिए मुझे त्रुटि संदेश प्राप्त होता है।
कंसोल:
> ERROR: Create notification failed
Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
errors = (
" Notifications must have English language content"
);
}}
मेरे पूरा समारोह:
func sendPush(_ receiverID: String, _ who: String, _ didWhat: String, _ message: String?) {
var subtitle = ""
var contents = ""
if message != nil {
contents = message!
}
switch didWhat {
case "likePost":
subtitle = "liked your post"
case "commentPost":
subtitle = "commented on your post"
case "likeComment":
subtitle = "liked your comment"
case "message":
subtitle = "sent you a message"
case "friendsRequest":
subtitle = "sent you a friend request"
case "friendAccept":
subtitle = "accepted your friend request"
case "follow":
subtitle = "just followed you"
default:
break
}
getOneSignalPlayerID(receiverID, completion: { result in
oneSignal.postNotification(["headings" : ["en": "\(who)"],
"subtitle" : ["en": "\(subtitle)"],
"contents" : ["en": "\(contents)"],
"include_player_ids": [result]],
onSuccess: { (success) in
if success != nil {
print(success!)
}
}, onFailure: { (failure) in
if failure != nil {
print(failure!)
crashlyticsLog("getOneSignalPlayerID", failure!.localizedDescription)
}
})
})
}
मैं क्या याद आ रही है? सहायता बहुत सराहना की है।
लगता है कि आप सही किया गया है। मेरे पास वैकल्पिक मानों के साथ एक फ़ंक्शन था, उदाहरण के लिए खाली स्ट्रिंग्स को उपशीर्षक निकाय के रूप में भेजना ... एक और ठोस त्रुटि संदेश उपयोगी होता ... आपकी मदद के लिए धन्यवाद –
आपका स्वागत है। कृपया 'उत्तर' के रूप में चिह्नित करें। – Vincent
मैं करूँगा। और मैं आपको बक्षीस भी दूंगा। बक्षीस के केवल 6 दिन बाकी हैं और शायद किसी के पास उपयोगी टिप्स या ऐसा कुछ है। चिंता मत करो। आप को मत भूलना होगा। –