nsexception

Xcode - Terminating with uncaught exception of type NSException when a button is pressed

巧了我就是萌 提交于 2019-12-01 20:55:28
I'm new to app development and I'm following Apple's tutorial to learn. I've looked through a lot of questions asked about this type of error but none of them are helping me. In the tutorial, I'm stuck on the "Add Buttons to the View" section where I'm trying to implement a string to be printed out on the console when a button is tapped/clicked on. Only I get an error when doing so. My code for the button in Swift: import UIKit class StarRatingControl: UIView { // MARK: Initialization required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) let button = UIButton(frame: CGRect(x: 0

NSException raise:format: as the last statement in a method

a 夏天 提交于 2019-12-01 19:03:30
I have this method: + (MHTwitterParser*)createParser:(NSString*)format { if ([format compare:@"json"] == NSOrderedSame) { return [[MHJsonTwitterParser alloc] init]; } [NSException raise:@"Unknown format" format:@"Unknown format of parser"]; } Compiler complains that: Control may reach end of non-void function It is just a warning, but it does not matter. Obvious fix for that is to add for example return nil; after the [NSException raise: ... . However, I think it is not needed (and is even misleading for readers), because the exception is thrown, so it is not true that "Control may reach end

Using AVCapturePhotoOutput in iOS10 - NSGenericException

泄露秘密 提交于 2019-12-01 13:41:20
I am currently trying to figure out how to use iOS 10's AVCapturePhotoOutput method and am having trouble doing so. I feel like I am about to get it right but continue receiving an error: Terminating app due to uncaught exception 'NSGenericException', reason: '-[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] No active and enabled video connection' I have tried to put this line of code in either the AVCapturePhotoCaptureDelegate or my didPressTakePhoto function: if let videoConnection = stillImageOutput.connection(withMediaType: AVMediaTypeVideo) { videoConnection.videoOrientation =

Using AVCapturePhotoOutput in iOS10 - NSGenericException

て烟熏妆下的殇ゞ 提交于 2019-12-01 10:31:19
问题 I am currently trying to figure out how to use iOS 10's AVCapturePhotoOutput method and am having trouble doing so. I feel like I am about to get it right but continue receiving an error: Terminating app due to uncaught exception 'NSGenericException', reason: '-[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] No active and enabled video connection' I have tried to put this line of code in either the AVCapturePhotoCaptureDelegate or my didPressTakePhoto function: if let

How to replace NSUncaughtExceptionHandler with definition in Breakpoint navigator?

醉酒当歌 提交于 2019-12-01 01:15:38
So far I used NSUncaughtExceptionHandler within code: void uncaughtExceptionHandler(NSException *exception) { NSLog(@"*************************************************"); NSLog(@"CRASH: %@", exception); NSLog(@"Stack Trace: %@", [exception callStackSymbols]); NSLog(@"*************************************************"); } NSUncaughtExceptionHandler *exceptionHandlerPtr = &uncaughtExceptionHandler; I know that in Xcode I can Add Exception Breakpoint for all exceptions: Then I can Edit Breakpoint : and finally I do not know how to configure this to replace my code from NSUncaughtExceptionHandler

Build universal app for iOS 3.0 using Xcode 4.3.x - NSKeyedUnarchiver Exception

Deadly 提交于 2019-11-30 22:23:57
Trying to build and debug a universal app for iOS 3.0 using Xcode 4.3.2. I'm getting a NSException from NSKeyedUnarchiver. It seems it may be related to inability to read the main .xib file. I have seen this: iOS and unarchiving xib files -- however, in that case it's not clear the app is Universal (their solution doesn't work) (NOTE: Their solution doesn't work because they're using Xcode 4.2, not 4.3). Here's the error output: 2000-01-01 11:00:39.-19 myApp[664:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSKeyedUnarchiver

Build universal app for iOS 3.0 using Xcode 4.3.x - NSKeyedUnarchiver Exception

不打扰是莪最后的温柔 提交于 2019-11-30 17:23:48
问题 Trying to build and debug a universal app for iOS 3.0 using Xcode 4.3.2. I'm getting a NSException from NSKeyedUnarchiver. It seems it may be related to inability to read the main .xib file. I have seen this: iOS and unarchiving xib files -- however, in that case it's not clear the app is Universal (their solution doesn't work) (NOTE: Their solution doesn't work because they're using Xcode 4.2, not 4.3). Here's the error output: 2000-01-01 11:00:39.-19 myApp[664:207] *** Terminating app due

How to replace NSUncaughtExceptionHandler with definition in Breakpoint navigator?

做~自己de王妃 提交于 2019-11-30 16:18:57
问题 So far I used NSUncaughtExceptionHandler within code: void uncaughtExceptionHandler(NSException *exception) { NSLog(@"*************************************************"); NSLog(@"CRASH: %@", exception); NSLog(@"Stack Trace: %@", [exception callStackSymbols]); NSLog(@"*************************************************"); } NSUncaughtExceptionHandler *exceptionHandlerPtr = &uncaughtExceptionHandler; I know that in Xcode I can Add Exception Breakpoint for all exceptions: Then I can Edit

An -observeValueForKeyPath:ofObject:change:context: message was received but not handled

怎甘沉沦 提交于 2019-11-30 14:31:04
问题 I am relatively new to KVO, so there is a good chance that I am violating some fundamental rule. I am using Core Data. My app crashes with the following message: And what I can't understand is why a CGImage is getting involved in observing a value that is set on a MeasurementPointer object. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<CGImage 0x276fc0>: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key

How to properly handle NSFileHandle exceptions in Swift 2.0?

被刻印的时光 ゝ 提交于 2019-11-30 06:41:07
First of all, I am new to iOS and Swift and come from a background of Android/Java programming. So to me the idea of catching an exception from an attempt to write to a file is second nature, in case of lack of space, file permissions problems, or whatever else can possibly happen to a file (and has happened, in my experience). I also understand that in Swift, exceptions are different from Android/Java ones, so that's not what I'm asking about here. I am attempting to append to a file using NSFileHandle, like so: let fileHandle: NSFileHandle? = NSFileHandle(forUpdatingAtPath: filename) if