Questions tagged [nsexception]

NSException is a Mac Developer Library class used to implement exception handling and contains information about an exception.

NSException is a Mac Developer Library class used to implement exception handling and contains information about an exception.

It is available in OS X v10.0 and later and is declared in NSException.h

259 questions
2
votes
3 answers

In Objective-c what I should use to return that parameter can't be nil?

I know that I can return that parameter can't be nil by NSError or throw NSException, but what is the best option to inform that parameter can't be nil in objective-c ?
Roman Barzyczak
  • 3,785
  • 1
  • 30
  • 44
2
votes
3 answers

Is it possible to get which class thrown the exception?

Is it possible to get which class thrown the exception at runtime? If so, then how to do it? What I want to do is to detect which class did throw the exception. I'm using NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *) to detect if my…
dzep
  • 685
  • 1
  • 8
  • 20
2
votes
1 answer

Terminating app due to uncaught exception 'NSInvalidArgumentException' using AWS iOS SDK

I'm having trouble with a simple multipart upload to S3 using the iOS SDK. Can't figure out the argument exception that's not being handled which occurrs with ~65 seconds of background time remaining ([UIApplication…
2
votes
1 answer

Using an NSPredicate to tell if an NSSet contains objects from another NSSet

I have a Core Data object that has an NSOrderedSet of Core Data objects in it called hierarchyItems. I want to create a fetch request that will check to see if the hierarchyItems set contains an object that is also in another NSMutableSet of Core…
user3200440
  • 23
  • 1
  • 4
2
votes
1 answer

Core Data: Errors vs Exceptions Part 2

My question is similar to this one, but I need further clarification. I often get exceptions during code like this: NSError* error; if (![managedObjectContext save:&error]) { NSLog(@"Failed to save to data store: %@", [error…
sehugg
  • 3,615
  • 5
  • 43
  • 60
2
votes
2 answers

Why does this code crash on the distributed app but work in the debugger?

I have simple code that executes and in case it crashes I want to catch the exception so the app does not crash. @try { x = [self try_doMyWork:Param]; } @catch (NSException* e) { NSLog(@"Exception"); } While this code works in debug and…
user387184
  • 10,953
  • 12
  • 77
  • 147
2
votes
2 answers

BugSense responding with status code 500 on iOS on a phonegap application

I am developing a phonegap application for iOS devices. I also integrated bugsense for iOS. I am using window.onError from javascript to catch errors and then use a Webview delegate method to perform exception handling. This is where I create a…
Khalil
  • 360
  • 1
  • 4
  • 14
1
vote
1 answer

Objective-c Try/Catch not catching

Is there a reason why the following wouldn't work? @try { CFGetTypeID( NULL ); } @catch (NSException * e) { NSLog(@"Exception: %@", e); } @finally { NSLog(@"finally"); } Similar to the try/catch question, only it seems the above block…
Corey Hart
  • 10,316
  • 9
  • 41
  • 47
1
vote
1 answer

RestKit RKObjectLoader objectLoader didLoadObjects failed on device

I am using RestKit and stuck with a problem. I've tried quite a lot of things to solve this, but return no success. :) - (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects { NSLog(@"objects count: %d.", [objects…
siriusdely
  • 139
  • 1
  • 9
1
vote
2 answers

Sign in with Apple in realm SwiftUI exception: unrecognized selector sent to instance

I am trying to implement sign in with apple to Realm. I already did the configuration from the docs: https://www.mongodb.com/docs/atlas/app-services/authentication/apple/#std-label-apple-id-authentication Now I am trying to add the sign in with…
1
vote
6 answers

iphone - try, catch question

I have a method that has several parts that can throw an exception. If one of these parts fail, I would like the cleaning method to run. I am thinking about using the try/catch directive. My question is: will I have to use one directive for every…
Duck
  • 34,902
  • 47
  • 248
  • 470
1
vote
2 answers

Exception throwing JSON supporting program in iphone

I downloaded JSON files. I added these files in project directory. But when I am runnig program I am getting an error which is... -[__NSCFDictionary JSONRepresentation]: unrecognized selector sent to instance 0x6003d50 * Terminating app due to…
Ajay_Kumar
  • 1,381
  • 10
  • 34
  • 62
1
vote
0 answers

I am getting an error when I try to run an app that will ask questions

I am trying to make an app that will ask questions and you have to answer True or False. This is part of an online course I am taking. I started with the challenge of displaying on the screen " four + two is equal to 6" and displaying it. Here is…
1
vote
1 answer

Swift 5 Firestore: Checking if collection exists in database

I'm trying to check if a certain collection exists in my Firestore database, and here is my code for doing so: let db = Firestore.firestore() db.collection(pickedClass).getDocuments { (snapshot, error) in if…
1
vote
1 answer

How can I make AutoLayout crash my app when it logs unsatisfiable constraints in debug console?

I am working in a team. When someone develops new UI using AutoLayout, they often test it on simulator/device and forget about the console. After months of such behavior debug console is flooded with unsatisfiable constraints logs and will attempt…
efimovdk
  • 368
  • 4
  • 16