经过测试,我发现尽管GKAchievement的percentComplete类型是双倍的,但在Apple的帮助文档中,合法值介于0.0和100.0之间.但是如果你向apple服务器报告percentComplete = 1.5,那么下次你将获得值percentComplete = 1.0(另一个例子,报告0.5,得到0.0).所以我认为这可能是%Complete的错误.现在我们的项目有一些成就需要积累,比如完成200次播放,我们
不保存本地值,而是向苹果服务器报告当前计数次数,以供下次计算.
我刚刚使用iOS 4.2在SandBox中测试过,我不知道它是否只出现在SandBox中,所以有人也发现了这个问题,你的工作是什么?
通常,我的代码可以从iCloud下载文件.但有时下载过程不会更新.
以下是一些代码剪辑:
开始下载:
NSFileManager* fm = [NSFileManager defaultManager];
if (![fm startDownloadingUbiquitousItemAtURL:file error:nil]) {
return NO;
}
/////////////////////////
id query = [[icloudClass alloc] init];
_query = query;
[query setSearchScopes:[NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]];
NSArray *listItems = [[file path] componentsSeparatedByString:@"/"];
NSPredicate *pred = [NSPredicate predicateWithFormat: @"%K == %@", NSMetadataItemFSNameKey, [listItems objectAtIndex:[listItems count] -1] ];
NSLog(@"filename = %@", [listItems objectAtIndex:[listItems count] -1]);
[query setPredicate:pred];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDownloading:) name:NSMetadataQueryDidUpdateNotification object:query];
[query startQuery];
Run Code Online (Sandbox Code Playgroud)
更新下载:
-(void)updateDownloading:(NSNotification *)notification {
id query = [notification object];
if ([query resultCount] /*>=*/ == …Run Code Online (Sandbox Code Playgroud)