I was going to set up a func for send push notifications from app to every downloaded app when the thing I needed to trigger so the func is:
func notification(debug:Bool,content:String){
let pushContent:[NSObject : AnyObject] = ["app_id" : [""], "contents": ["en": content]]
OneSignal.postNotification(pushContent)
}
The error is:
Ambiguous reference to member 'postNotification'
I checked the API Reference they gave a example like this that is't working as well.
OneSignal.postNotification(["contents": ["en": "Test Message"], "include_player_ids": ["3009e210-3166-11e5-bc1b-db44eb02b120"]])
The error is:
'(dictionaryLiteral: (NSObject, AnyObject), (NSObject, AnyObject))' is not convertible to '(dictionaryLiteral: (NSString, NSObject)...)', tuples have a different number of elements
How can I make this work?
And yes it's up to date. Using OneSignal (1.13.2)
postNotification
and most OneSignal functions are instance functions. You will need to use the same instance that was created from didFinishLaunchingWithOptions
or use the OneSignal.defaultClient()
helper to get the current instance.
Example:
OneSignal.defaultClient().postNotification(["contents": ["en": "Test Message"], "include_player_ids": ["3009e210-3166-11e5-bc1b-db44eb02b120"]])