0
私はクラスメソッドの中で次の問題を抱えています。いくつかの長い実行プロセスを実行すると、渡されたパラメータの割り当てが解除されているようです。メソッドのパラメータが使用される前に割り当て解除されます
私はこのクラスの外からメソッドを呼び出しています。
+ (void)downloadVideoForExercise:(Exercise *)exercise{
dispatch_queue_t serialQueue = dispatch_queue_create("com.blah.queue", DISPATCH_QUEUE_SERIAL);
dispatch_async(serialQueue, ^{
[self isMaximumDownloadCapacityReached:^(BOOL success) {
if (success) {
return;
}
}];
[self shouldDownloadVideoForExercise:exercise
andCompletionBlock:^(BOOL success) {
if (success == NO) {
return;
}
}];
[NetworkManager downloadFileFromURL:exercise.videoServerURL
andSaveLocally:YES
andCompletion:^(BOOL success) {
dispatch_async(dispatch_get_main_queue(), ^{
RLMRealm *realm = [RLMRealm defaultRealm];
if (![realm inWriteTransaction]) {
[realm beginWriteTransaction];
}
if (success) {
//save the new local link
NSString *videopath = [NetworkManager getVideoLocalURLFromServerURLForExercise:exercise.videoServerURL];
exercise.videoLocalURL = videopath;
//change flag for ExerciseVideoDownloadState
exercise.videoDownloadState = isDownloadCompleted;
}else{
//change flag for ExerciseVideoDownloadState
exercise.videoDownloadState = isNotDownloaded;
}
if ([realm inWriteTransaction]) {
[realm commitWriteTransaction];
}
});
}];
});
}
は、私はすでに__strongや__block ではなく、成功せずに渡されたパラメータを使用して考えました。 ご協力いただきありがとうございます。
どのパラメータを参照していますか?それは助けになるだろう。 –
私はメソッドに渡されたパラメータを参照しています。これらの場合はオブジェクトです: '(エクササイズ*)エクササイズ' –
「解約されたようです」とはどういう意味ですか? – newacct