I'm trying to follow the Parse Guide to handle the notifications i send in Json format, but i'm having a problem, here is my code:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
// Override point for customization after application launch.
Parse.setApplicationId("MyAppId", clientKey: "MyAppClientKey")
var notificationType: UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
var settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationType, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().registerForRemoteNotifications()
if let launchOptions = launchOptions {
var notificationPayload: NSDictionary = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] as NSDictionary!
println(launchOptions)
var url = notificationPayload["url"] as String
var feed: FeedTableViewController = FeedTableViewController()
feed.messages.insert(url, atIndex: 0)
feed.sections.insert("section", atIndex: 0)
}
return true
}
the app doesn't crash now, but the changes i made doesn't take place. Json code:
{
"aps": {
"badge": 10,
"alert": "Test",
"sound": "cat.caf"
},
"url": "http://www.google.com"
}