14
Tôi muốn lưu dữ liệu trò chơi bằng phương pháp GKLocalPlayer và saveGameData.Sự cố với GKLocalPlayer và 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);
}
}];
Mã trên hoạt động tốt trên trình mô phỏng xcode, nhưng khi tôi thử trên iPhone, tôi nhận được mã lỗi hiển thị bên dưới. Tôi không thể hiểu được điều này. Tôi không có quyền kiểm soát nơi nó lưu dữ liệu trò chơi vậy tại sao hệ thống đang cố gắng lưu nó ở nơi mà nó không có sự cho phép!?!
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"}
// Micke ...
Bạn đã khắc phục sự cố này chưa? – Oli