2016-09-01 2 views
2

AppDelegate.swift에서 아래 코드를 사용하여 기본보기 컨트롤러를 변경하기 위해 사용자가 로그인했는지 확인합니다.구문 분석 사용자 정보를 업데이트 할 수 없음 - Swift

if let user = PFUser.currentUser()!["username"] { 

     print("asldkeu \(user)") 
     // Code to execute if user is logged in 
     let storyboard = UIStoryboard(name: "Main", bundle: nil) 
     let viewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") 

     self.window?.rootViewController = viewController 
     self.window?.makeKeyAndVisible() 

    } else { 
     // Default screen you set in info plist. 
    } 

올바르게 작동하지만 문제가 발생하면 온라인 구문 분석 사용자 데이터를 업데이트 할 수 없습니다. 내 Heroku가 구문 분석 응용 프로그램에 데이터를 업데이트 할 때마다 나는 오류 코드 아래 얻을 :

오류 도메인 = 구문 분석 코드 = 206 "사용자가 수정할 수 없습니다 Jpibm8rWyI"사용자 정보 = {코드 = (206), 일시 = 0, 오류 =

if let games = PFUser.currentUser()?["gamesWon"]! { 
      print("asldkeu server: \(games as! Int)") 

      gamesWon = (games as! Int) + 1 
       print("asldkeu update: \(gamesWon)") 
      } 


      PFUser.currentUser()?["gamesWon"] = gamesWon 

      do { 
       try PFUser.currentUser()!.save() 
      } catch { 
       print("asldkeu \(error)") 
      }} 

내가 PFUser.currentUser()! saveInBackground()를 사용하는 경우 내가 '돈 : 나는 구문 분석 데이터를 업데이트하는 코드 아래 사용하고 사용자에게

를 수정할 수있는 사용자 Jpibm8rWyI, NSLocalizedDescription을 = 수정할 수 없습니다 오류는 발생하지만 데이터는 저장되지 않습니다.

어떻게 해결할 수 있습니까?

+0

? 이상의 사람이 있다는 것을 대신 PFUser.currentUser()?["gamesWon"] = gamesWon

사용

PFUser.currentUser()!["gamesWon"] = gamesWon 

? 어떤 것? – ToroLoco

+0

정말로 로그인 했습니까? 자신의 사용자 만 변경할 수 있습니다 – JVS

+0

사용자가 올바르게 로그인되었습니다. – ToroLoco

답변

0

당신은 사용자의 랩핑을 강요하지 않습니다. ! 오히려

관련 문제