title: Convert NSObject to NSDictionary JSON swift 2.0
body: <p>I try to make a receive notification with JSON inside. so i code inside AppDelegate.swift. 
  I have a problem with converting NSObject to NSDictionary.</p>
  
  <p>Here is my code :</p>
  
  <blockquote>
  <pre><code>func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
          PFPush.handlePush(userInfo)
  </code></pre>
  </blockquote>
  
  <pre><code>        if application.applicationState == UIApplicationState.Active {
  
              PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
              let msg = userInfo["test"] as? NSObject
              print(userInfo)
  
              if msg == nil{
  
                      let dict = msg as! Dictionary&lt;String, Dictionary&lt;String, Array&lt;Dictionary&lt;String, AnyObject&gt;&gt;&gt;&gt;
                      let tests = dict["test"]!["test"]!
                      for test in tets {
                          let header : AnyObject? = test["message"]
                          let body : AnyObject? = test["aps"]
                          let url : AnyObject? = test["link"]
  
                          print("test ID: \(header)")
                          print("test Name: \(body)")
                          print("test Needs Password: \(url)")
  
  
                  }
              }
          }
  </code></pre>
  
  <p>there are 2 problem :
  1. i've already receive the JSON Data as Object
  let msg = userInfo["test"] as? NSObject</p>
  
  <pre><code>Printing description of userInfo:
      ▿ 3 elements
        ▿ [0] : 2 elements
          - .0 : message
          - .1 : test iOS
        ▿ [1] : 2 elements
          - .0 : aps
          - .1 : 0 elements
        ▿ [2] : 2 elements
          - .0 : link
          - .1 :
  </code></pre>
  
  <p>But my msg is nil. so i have to do this code to continue if msg == nil</p>
  
  <ol start="2">
  <li>i don't know how to use NSJSONSerialization, because the error always showed " Cant convert NSObjet to NSData type"</li>
  </ol>