当我打开推送通知时,为什么应用程序会崩溃?

时间:2015-12-28 23:17:46

标签: ios swift

我正在尝试在推送通知打开时打开特定页面,但它会继续崩溃。为什么会这样?

    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    PFPush.handlePush(userInfo)
  let text = userInfo["aps"]!["alert"]
    let title = userInfo["aps"]!["alert"]!!["title"]
    let artist = userInfo["aps"]!["alert"]!!["artist"]
    print(text)
    print(title)
    print(artist)

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewControllerWithIdentifier("PlayerController") as! PlayerViewController
    vc.dataModel.artistplay = artist as? String
    vc.dataModel.titleplay = title as? String
    vc.playerartist.text = artist as? String
    vc.playertitle.text = title as? String
    window?.rootViewController = vc

    }

这些是PlayeViewController中的变量

class PlayerViewController: UIViewController, UIPopoverPresentationControllerDelegate {

@IBOutlet weak var playertitle: UILabel!
@IBOutlet weak var playerartist: UILabel!
@IBOutlet weak var play: UIButton!
@IBOutlet weak var share: UIButton!
@IBOutlet weak var love: UIButton!

var dicData : NSDictionary?
var dataModel = DataModelTwo()
var data: NSDictionary?
var shareDataModel: Share?
var buttonState: Int = 0;

var liked = [String]()

以下是DataModelTwo

class DataModelTwo : NSObject{
var titleplay: String?
var artistplay: String?
}

0 个答案:

没有答案