我正在使用
-com.apple.CoreData.ConcurrencyDebug
Run Code Online (Sandbox Code Playgroud)
在我的CoreData应用程序中启动以调试并发性的论点.
在应用程序启动期间,我在主线程的托管对象上下文中执行异步提取.
// set up the async request
NSError * error = nil;
[MOC executeRequest:asyncFetch error:&error];
if (error) {
NSLog(@"Unable to execute fetch request.");
NSLog(@"%@, %@", error, error.localizedDescription);
}
Run Code Online (Sandbox Code Playgroud)
从主线程调用此代码,但executeRequest:将其排入另一个线程,我理解这是正确的行为.
并发调试器不喜欢这样,说(我估计)我在这里做错了.我也尝试将[MOC performBlock:]其包装在其中也有效,但也会导致多线程违规.在这两种情况下,我得到这个:
[NSManagedObjectContext __Multithreading_Violation_AllThatIsLeftToUsIsHonor__
Run Code Online (Sandbox Code Playgroud)
我是否错误地使用异步提取,或者并发调试器在这里是错误的?
编辑:我也尝试将其包装在MOC中performBlock,这应该确保从主线程调用它.在任何情况下,调用都从主线程入队,但在其他地方执行.
编辑:这是获取请求:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"MyEntity"];
NSPredicate * pred = [NSPredicate predicateWithFormat:@"boolProperty == YES"];
fetchRequest.predicate = pred;
NSSortDescriptor * sort = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES];
fetchRequest.sortDescriptors = @[sort]; fetchRequest.propertiesToFetch = @[@"prop1", @"prop2", @"prop3", @"prop4"]; …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用了一个公共的iCloud数据库,它运行良好并且在商店中.
在将我的应用程序更新为新版本(在iOS9上使用Xcode 7)时,我遇到了崩溃:
CKContainer * container = [CKContainer containerWithIdentifier:@"iCloud.com.identifier"];
*** Terminating app due to uncaught exception 'CKException', reason: 'The application is missing required entitlement com.apple.developer.icloud-services'
Run Code Online (Sandbox Code Playgroud)
这仅在更新后首次启动应用程序时发生,并且仅在iOS9上发生.在第一次(更新)启动之后,应用程序启动并且iCloud按预期工作.
我可以通过下载应用程序的当前商店版本,然后从Xcode 7运行更新的应用程序来一致地重新创建崩溃.
如果我使用iOS8执行相同的步骤(下载生产应用程序和更新),我没有相同的崩溃.
我猜这是一个iOS9或Xcode 7的错误.有任何想法吗?
编辑:这实际上发生在iOS9上首次启动应用程序,无论我是更新还是只是首次安装.
我在这里看了一堆答案,没有人解决我的问题.
我有一个带有自定义框架和iOS应用程序项目的Xcode工作区.该项目一直工作到今天早上,现在它构建但立即崩溃:
dyld: Library not loaded: @rpath/ONCKit.framework/ONCKit
Referenced from: /private/var/mobile/Containers/Bundle/Application/4DF67A3F-6255-4276-8812-8C742A363995/atero_t.app/atero_t
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/4DF67A3F-6255-4276-8812-8C742A363995/atero_t.app/Frameworks/ONCKit.framework/ONCKit: mmap() error 1 at address=0x100118000, size=0x000B8000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/4DF67A3F-6255-4276-8812-8C742A363995/atero_t.app/Frameworks/ONCKit.framework/ONCKit
/private/var/mobile/Containers/Bundle/Application/4DF67A3F-6255-4276-8812-8C742A363995/atero_t.app/Frameworks/ONCKit.framework/ONCKit: mmap() error 1 at address=0x100280000, size=0x000B8000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/4DF67A3F-6255-4276-8812-8C742A363995/atero_t.app/Frameworks/ONCKit.framework/ONCKit
Run Code Online (Sandbox Code Playgroud)
我整天都在尝试构建设置而且我完全迷失了.
所有突然的Xcode 在我的对象的开头给我一个错误"意外'@'在程序中"@interface.
这是在我以前工作的一堆物体中发生的......
这是一个例子(评论中有错误)
#import <UIKit/UIKit.h>
#import "ONCOChordDiamond.h"
@interface ONCOChordView : UIView //// unexpected '@' in program
{
NSMutableArray* chordDiamonds;
NSUInteger diamondWidth, diamondHeight;
}
@end /////unexpected '@' in program'
Run Code Online (Sandbox Code Playgroud)
那么为什么Xcode会给我这个错误?这似乎是个bug.
我有一个静态NSTextField,在我的OS X应用程序中覆盖了一个大的错误消息.我试图让它允许用户点击它下面的控件.
在IB中,我取消选中"已启用",并且我已选中"拒绝第一响应者"
我也在代码中完成它,因为它不起作用:
[largeErrorText setEnabled:NO];
[largeErrorText setRefusesFirstResponder:YES];
Run Code Online (Sandbox Code Playgroud)
它仍然妨碍了与它下面的物体的互动.任何想法可能是什么?
我正在使用加速框架来优化我的DSP代码.有几次我想将一个数组(或数组的一部分)的内容复制到另一个数组.
我似乎无法找到合适的函数来执行此操作,因此我一直在做一些愚蠢的事情,即将数组乘以1(或加0)并以此方式获取副本.
float one = 1;
float sourceArray = new float[arrayLength];
/////....sourceArray is filled up with data
float destArray = new float[arrayLength];
vDSP_vsmul(sourceArray, 1, &one, destArray, 1, arrayLength);
Run Code Online (Sandbox Code Playgroud)
必须有一个更好的方法来做到这一点!?谢谢!
这应该真的有效,但不是:
CATextLayer* textLayer = [CATextLayer layer];
textLayer.string = @"text";
[textLayer setValue:[NSNumber numberWithDouble:M_PI / 2.f forKey:@"transform.rotation"];
[self addSublayer:textLayer];
Run Code Online (Sandbox Code Playgroud)
事实上,当我在transform.rotation上打印值时,它会显示正确的答案.它只是没有绘制textLayer旋转!
NSLog(@"rotation %@", [textLayer valueForKey:@"transform.rotation"]);
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
ios ×4
cocoa ×3
objective-c ×2
xcode ×2
catextlayer ×1
cloudkit ×1
cocoa-touch ×1
concurrency ×1
core-data ×1
dylib ×1
frameworks ×1
icloud ×1
ios9 ×1
macos ×1
nsobject ×1