I'm trying to send a notification from device to device i have done this before on my other app but for some reason i get this error message
Extra argument 'method' in call
inside the alamofire.request function on method. I have searched online for hours now and i have tryed a bunch of solutions but nothing has been working for me i get the same error message what ever i do.
func setUpPushNotification(fromDevice: String) {
let title = ""
let body = "You got a friend request"
let toDeviceID = fromDevice
var headers:HTTPHeaders = HTTPHeaders()
let Method = Alamofire.HTTPMethod.post
headers = ["Content-Type":"application/json","Authorization":"key=\(AppDelegate.SERVERKEY)"]
let notification = ["to":"\(toDeviceID)","notification":["body":body,"title":title,"badge":1,"sound":"default"]] as [String : Any]
Alamofire.request(AppDelegate.NOTIFICATION_URL as URLConvertible,
method: Method,
parameters: notification,
encoding: JSONEncoding.default,
headers: headers).responseJSON { (response) in
print(response)
}
}
thanks for your time. :)