title: Parse - Setting device token
body: <p>I am trying to set a device token in parse. The official documentation gives the following code for doing this</p>
  
  <p><strong>Official Documentation(objective C)</strong></p>
  
  <pre><code>- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    currentInstallation.channels = @[ @"global" ];
    [currentInstallation saveInBackground];
  }
  </code></pre>
  
  <p>I have converted the code as below but receive an error.</p>
  
  <p><strong>My code (Swift)</strong></p>
  
  <pre><code>func application( applcation: UIApplication!, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData! ) {
      println(deviceToken)
  
    let currentInstallation = PFInstallation.currentInstallation()
  
              currentInstallation .setDeviceTokenFromData(deviceToken)
              currentInstallation .setObject(PFUser.currentUser(), forKey: "owner")
              currentInstallation .addUniqueObject("Test", forKey: "channels")
              currentInstallation .save()
  </code></pre>
  
  <p>I receive the following error when running my code:</p>
  
  <pre><code> Break on warnBlockingOperationOnMainThread() to debug.
  2014-11-13 03:44:01.306 Meetr[8855:2084537] Error: invalid type for key deviceToken, expected array, but got string (Code: 111, Version: 1.4.2)
  sent
  </code></pre>
  
  <p>Can anybody help me as to why this is? I'm very confused as I have simply converted the original objective C code to swift.</p>
  
  <p>Thanks in advance.</p>