0
私はすぐにコードを変換することができたらいいと思います。メソッドの宣言型がどのようなもので、どのようなものが使われているのか教えてください。objcではこの構文の意味は何ですか?
-(void)sync:(void (^)(UIBackgroundFetchResult result))handler {
// Make sure not to launch to syncing process at the same time
if(syncing) {
if(handler) {
handler(UIBackgroundFetchResultNoData);
}
return;
}
syncing = YES;
[[VDARSDKController sharedInstance].afterLoadingQueue addOperationWithBlock:^(void) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSArray *tags = nil;
// If you need to synchronize with tags, you can add some tags this way:
tags = @[ [VDARTagPrior tagWithName:@"BusDev"] ];
//Synchronize the local DB. The old models which are not anymore needed will be automatically deleted.
[[VDARRemoteController sharedInstance] syncRemoteModelsAsynchronouslyWithPriors:tags withCompletionBlock:^(id result, NSError *err) {
syncing = NO;
NSLog(@"PixLive System got the following models: %@",result);
if(err)
NSLog(@"The system got an error: %@",err);
if(handler) {
handler(err ? UIBackgroundFetchResultFailed : UIBackgroundFetchResultNewData);
}
}];
});
}];
}
それはブロックです。最も近い「即時」相当額はクロージャーです。 – trojanfoe