Tag: exception处理

“这个class级不是关键的价值…”

在过去的几天,我一直得到这个错误,每次我在xCode中运行一个构build: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x1dd4a1c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key playBtn.' 开始的时候是我做的东西。 比我删除它,它仍然存在 – 在一个对象(像这个playBtn在这里),不存在了。 现在 – 在我试图debugging的每一个应用程序。 如果在我的iPhone或模拟器 – 相同。 我现在不能运行任何东西! *清洁不起作用! * 我该怎么办? 我不能这样工作 注意:解决了。 这是appdelegate.m的问题,谢谢谁帮忙。

加载主XIB使iOS 3.0上的应用程序崩溃

感谢您抽出一些时间来阅读我的问题。 我有这个应用程序(在Cydia),其中约有10%的用户与iOS 3.0,所以我想在我的下一个更新中支持他们。 我使用运行iOS 4.0和5.0.1的实际设备对其进行了testing; 它工作正常。 但是,在iOS 3.0上,它崩溃了一个例外: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69) 显然在加载主要的XIB时,这里是exception的回溯: 0 0x30016588 in objc_exception_throw () 1 0x30224026 in +[NSException raise:format:arguments:] () 2 0x30223fc6 in +[NSException raise:format:] () 3 0x305564b4 in -[NSKeyedUnarchiver initForReadingWithData:] () 4 0x3094927c […]

initWithString的NSURL对象给出了 – 错误

我试图find一个文件的path,然后删除它使用NSFileManager类。 [info objectForKey:UIImagePickerControllerMediaURL]确实返回一个string,所以我不明白为什么它失败了一个有效的参数。 NSError *error; NSFileManager *manager = [NSFileManager defaultManager]; NSURL *url = [[NSURL alloc] initWithString:[info objectForKey:UIImagePickerControllerMediaURL]]; if ([manager isDeletableFileAtPath: [info objectForKey:UIImagePickerControllerMediaURL]]) { BOOL success = [manager removeItemAtURL:url error:&error]; if (!success) { NSLog(@"Error removing file at path: %@", error.localizedDescription); } } 我得到这个错误: *** Terminating app due to uncaught exception 'NSInvalidArgumentException' , reason: '-[NSURL length]: unrecognized […]

当应用程序在后台模式下工作时,CoreData错误/exception

我正在做一个multithreading的CoreBluetooth应用程序,其中iPhone正在作为一个中央,扫描(基于UI交互)的外设,然后连接和处理,导致应用程序的CoreData模型的各种更改,用于存储用户可以访问的不同外设的状态(而不必在用户每次启动应用程序时连接到它们)。 用户基本上通过UI请求与外围设备的连接,然后UI发起asynchronous工作者线程,尝试在特定的时间范围内(例如几分钟)完成请求,否则向UI报告失败/超时。 一切工作正常,但我现在刚开始添加对后台执行的支持,因为用户很可能会启动asynchronous工作线程,开始扫描BLE外设,然后locking手机并放在口袋里,当外围设备到达时,期待事物发挥作用。 然而,蓝牙智能的东西,他们应该(外设发现,连接和处理),但我突然得到的CoreDataexception; CoreData: error: exception during newFetchedPKsForSourceID: I/O error for database at /var/mobile/Applications/8640B48D-8744-436A-A083-C39F63FBFB3F/Documents/Model.sqlite. SQLite error code:266, 'not an error' errno:1 with userInfo of { NSFilePath = "/var/mobile/Applications/8640B48D-8744-436A-A083-C39F63FBFB3F/Documents/Model.sqlite"; NSPOSIXErrorDomain = 1; NSSQLiteErrorDomain = 266; } CoreData: error: exception during newFetchedPKsForSourceID: authorization denied with userInfo of { NSFilePath = "/var/mobile/Applications/8640B48D-8744-436A-A083-C39F63FBFB3F/Documents/Model.sqlite"; NSSQLiteErrorDomain = 23; } CoreData: […]

Swift 2.0exception处理

我们想知道整个SWIFT代码块的error handling机制。 因为,在迅速,有一些技术用于error handling,其中一些就像使用guard或if let 。 我们也可以使用do – catch语句来实现它。 但是我们在使用单个try-catch块来处理大量代码时遇到了困难,就像我们在Objective-C中所做的那样。 在Objective-C这个块很容易处理任何代码行中的错误。 所以我们想迅速地知道这种机制。 现在,我们知道如果我们需要处理错误,那么对每行使用guard , if-let语句,或者编写一些自定义的方法来抛出错误,并在do-catch块中使用该方法。 那么Swift中有没有什么机制可以像Objective-C一样与try-catch块并行,所以我们不需要为整行代码中的每一行代码编写if-let或guard语句。 这就是我们如何使用if-let和guard让单行声明为null处理: if-let实现示例代码片段: – if let title = dict["title"].string { let myTitle = title } 但是下面提到了我们希望在代理函数中用于try-catch块的swift解决scheme。 Objective-C使用try-catch块的示例代码片段 – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { @try { static NSString *itemIdentifier = @"CustomCell"; //Some line of code where exception may occur… //Some […]

'NSInvalidArgumentException':尝试滚动到无效的索引path

这是我的animationCollectionViewCustomCells的代码。 -(void)viewDidAppear:(BOOL)animated{ rowIndex = 0; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(targetMethod) userInfo:nil repeats:YES]; } -(void)targetMethod { [self.offerCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:rowIndex inSection:1] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES]; rowIndex=(rowIndex<parserDataContentArrayForExhibitor.count-1)?(rowIndex+1):0; // if (rowIndex == parserDataContentArrayForExhibitor.count) { // rowIndex = 0; // } } Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'attempt to scroll to invalid index path: <NSIndexPath 0xab55110> 2 indexes [1, 0]' […]

CRASH:*** – :index bound 4294967295 beyond bounds

我在这个荒谬的索引,得到一个数组越界的错误,根据我的研究表明,可能有一些代码调用负数,如[array objectAtIndex: -1]问题是,这不是我的代码,我不能在任何地方find它 我已经把各处的断点无济于事。 我想这可能是在UITableView委托方法,但不能确定。 有无论如何访问日志中所有我的intvariables的值。 我不能NSLog他们,因为我不知道崩溃发生的地方。 谢谢!

NSCFType的iOSexception是什么?

我的代码工作了一段时间,但有时会抛出以下exception。 这个错误与内存pipe理有关吗? 我寻找什么? 代码稍后指定。 帮助赞赏。 谢谢 iNMV [1067:307] – [__ NSCFType stringByAppendingString:]:无法识别的select器发送到实例0x10dc90。 iNMV [1067:307]exception:捕获NSInvalidArgumentException: – [__ NSCFType stringByAppendingString:]:无法识别的select器发送到实例0x10dc90 NSString *url = [realURLArray objectAtIndex:page * [svc maxNumberOfImages] + i]; NSString *thumbUrl = [url stringByAppendingString:@".128×128.jpg"];

如何使用NSSetUncaughtExceptionHandler获取未捕获的exception的类,方法和行号

我使用了NSSetUncaughtExceptionHandler(&HandleExceptions); 用于处理方法中未捕获的exception void HandleExceptions(NSException *exception) { } 我想打印类,方法和行号,发生exception的任何解决scheme? 我得到以下堆栈跟踪 0 appName 0x00000001000b6a20 HandleExceptions + 584 1 appName 0x00000001002175f0 GAIUncaughtExceptionHandler + 716 2 CoreFoundation 0x00000001852fe95c <redacted> + 692 3 libobjc.A.dylib 0x0000000195a103b4 <redacted> + 116 4 libc++abi.dylib 0x0000000195211bb4 <redacted> + 16 5 libc++abi.dylib 0x000000019521173c __cxa_rethrow + 144 6 libobjc.A.dylib 0x0000000195a10294 objc_exception_rethrow + 44 7 CoreFoundation 0x00000001851e1154 CFRunLoopRunSpecific […]

当我在设备上运行我的应用程序时,dyld`gdb_image_notifierexception

当试图加载我的应用程序在设备上,有时我得到以下exception dyld`gdb_image_notifier:0x2beca0cc:bx lr 但停止后再次运行一切正常,谁能告诉我为什么会发生这种情况