0
下面的代碼可以從線程中找到(下面的鏈接),我似乎無法將其轉化爲快速解決方案,因爲代碼的缺陷似乎不是一種直觀的修復方法迅速(至少從我的理解)...從解析推送通知中提取消息的快速解決方案
有人可以請幫助翻譯此代碼,我需要能夠從swift中讀取解析推送通知的消息(我相信這個代碼在目標c )
Extract "alert" text from push notification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[PFPush handlePush:userInfo];
pushText = [userInfo objectForKey:@"alert"];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"News", "")
message:pushText
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[alert show];
}
有不可替代的第一閱讀文檔:https://developer.apple.com/library/prerelease/ios/documentation/Swift /Conceptual/Swift_Programming_Language/CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-ID105 –