use*_*732 14 objective-c gamekit ios game-center
我想用GKLocalPlayer和saveGameData方法保存游戏数据.
[localPlayer saveGameData:playerData withName:@"SolarFlares" completionHandler:^(GKSavedGame *savedGame, NSError *error) {
if (savedGame != nil) {
NSLog(@"Player data saved to GameCenter");
}else{
NSLog(@"Player=%@ data NOT saved to GameCenter, error=%@", localPlayer, error.description);
}
}];
Run Code Online (Sandbox Code Playgroud)
上面的代码在xcode模拟器上工作正常,但是当我在我的iPhone上尝试它时,我得到如下所示的错误代码.我无法弄清楚这一点.我无法控制它保存游戏数据的位置,那么为什么系统会尝试将其保存在没有权限的地方!?!
Error Domain=NSCocoaErrorDomain Code=513 "The operation couldn’t be completed. (Cocoa error 513.)" UserInfo=0x171661f80
{NSFileOriginalItemLocationKey=file:///private/var/.DocumentRevisions-V100/PerUID/501/e4/com.apple.ubiquity/iCloud~com~MJinc~SolarFlares_A3695FA3-6BFA-4862-B53A-F01E192726CC_1a.bundle/,
NSURL=file:///private/var/.DocumentRevisions-V100/PerUID/501/e4/com.apple.ubiquity/iCloud~com~MJinc~SolarFlares_A3695FA3-6BFA-4862-B53A-F01E192726CC_1a.bundle/,
NSFileNewItemLocationKey=file:///private/var/mobile/Containers/Data/Application/EF8BC999-1D4B-42B2-B8D9-0B0A79543C03/tmp/(A%20Document%20Being%20Saved%20By%20Solar%20Flares)/iCloud~com~MJinc~SolarFla
res_A3695FA3-6BFA-4862-B53A-F01E192726CC_1a.bundle, NSUnderlyingError=0x170c48b50 "The
operation couldn’t be completed. Permission denied"}
Run Code Online (Sandbox Code Playgroud)
// Micke ...
归档时间: |
|
查看次数: |
711 次 |
最近记录: |