【发布时间】:2015-09-22 11:54:06
【问题描述】:
在 iOS 9 发布 (Xcode 7.0) 后,我们在应用商店中的应用会间歇性崩溃,当我们尝试使用 iOS 9 编译我们的代码库时,我们会在这段代码中看到编译器错误
/* Check for dependent errors */
__block NSError *dependentError = nil;
[self.dependencies enumerateObjectsUsingBlock:^(CustomBaseOperationLoader *operation, NSUInteger idx, BOOL *stop) {
if (operation.operationError != nil) {
dependentError = [operation.operationError copy];
*stop = YES;
}
}];
不兼容的块指针类型发送'void (^)(CustomBaseOperationLoader *__strong, NSUInteger, BOOL *)' 到 'void (^ _Nonnull)(NSOperation * _Nonnull __strong, NSUInteger, BOOL * _Nonnull)'
iOS 新手,还有其他人面临这个问题或知道如何解决这个问题吗? 在 iOS 9 更新之前我们没有看到它,因此某些地方已弃用。
并且CustomBaseOperationLoader 扩展了NSOperation 一些自定义属性
更新: 根据以下答案,我将方法调用更改为
__block NSError *dependentError = nil;
[self.dependencies enumerateObjectsUsingBlock:^ _Nonnull(CustomBaseLoaderOperation * _Nonnull operation, NSUInteger idx, BOOL * _Nonnull stop) {
if (operation.operationError != nil) {
dependentError = [operation.operationError copy];
*stop = YES;
}
}];
现在我明白了:
控制到达非空块的末尾
更新 2: 添加了一个返回块,这似乎解决了错误 这是正确的处理方式吗?
/* Check for depended errors */
__block NSError *dependentError = nil;
[self.dependencies enumerateObjectsUsingBlock:^ _Nonnull(CustomBaseLoaderOperation * _Nonnull operation, NSUInteger idx, BOOL * _Nonnull stop) {
if (operation.operationError != nil) {
dependentError = [operation.operationError copy];
*stop = YES;
}
return;
}];
更新: 现在 xcode 刚刚在
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
还不确定该去哪里
【问题讨论】:
-
我认为这个问题的唯一答案会对你有所帮助:stackoverflow.com/questions/32540701/…
标签: ios objective-c ios9