Questions tagged [nsassert]

NSAssert is an Objective-c Macro on Cocoa and Cocoa Touch which will generate an assertion if a given condition is false.

NSAssert is an Objective-c Macro on Cocoa and Cocoa Touch. It will evaluate a given condition. If the condition is false, then an exception will be thrown.

Visit Apple's Developer Documentation for more details.

See Also: , , , and NSAssert1

27 questions
2
votes
3 answers

NSAssert in Singleton : why this code is valid?

i don't understand the use of NSAssert in +alloc, as when +alloc is called from +sharedGameManager, the static _sharedGameManager variable is nil (so NSAssert should stop execution the first time [self alloc] init] is…
Paul
  • 6,108
  • 14
  • 72
  • 128
1
vote
0 answers

How can I get asserts in my iOS framework to just print the filename instead of the entire path?

Say the following assert is hit in my code: NSAssert(NO, @"This assert should always be hit."); At the top of the stack trace, the entire path to the file is printed: Assertion failure in +[Foo barMethod:],…
gran_profaci
  • 8,087
  • 15
  • 66
  • 99
0
votes
3 answers

NSAssert undeclared first use why?

i used the code below in the levelManager.m to read values from a plist but when I am making an Archive to upload to itunes (AppStore) I get an error. why ? the code : - (float)floatForProp:(NSString *)prop { NSNumber * retval = (NSNumber *)…
Bobj-C
  • 5,276
  • 9
  • 47
  • 83
0
votes
1 answer

Is raising NSInternalInconsistencyException guaranteed to crash by default?

I use NSAssert to detect unrecoverable conditions in my code. I enabled assertions in release mode as well because if an assertion fails in my code, it's guaranteed to be unrecoverable. NSAssert raises NSInternalInconsistencyException and I've read…
Monstieur
  • 7,992
  • 10
  • 51
  • 77
0
votes
2 answers

Practice for handling errors in Objective C client code

I’ve seen Objective C code using a collection of practices, raging from passing a pointer of NSError for execution finish status - to using ‎NSAssert - to implementing @throw - to relaying on delegate for status code returned in the callback - to…
Maxim Veksler
  • 29,272
  • 38
  • 131
  • 151
0
votes
2 answers

ios : How to get photo url which is deleted in photo.app

I am having issue in my app, the app is photo related, In my app I have required photo url which is deleted via Photo.app, is there any way to find in our app that which photo is deleted in photo.app Thanks in advance.
Bhavesh Dhaduk
  • 1,888
  • 15
  • 30
0
votes
2 answers

Will NSAssert takes any memory on the device in iOS?

If we run the app on device with NSLogs then it may slow down the app to some extent. Is NSAssert act in the same way as NSLog in the memory aspect? Any comments or suggestions would be appreciated. Thank you in advance.
Ashok
  • 5,585
  • 5
  • 52
  • 80
0
votes
1 answer

ios NSAssert analog for normal build?

It recently came to my attention that NSAssert only works in debug mode. Is there an analog that will work in normal builds?
user1802143
  • 14,662
  • 17
  • 46
  • 55
0
votes
1 answer

Can I combine a release and debug build of a static library into one binary?

I want to allow a third party to use our static library in debug mode with assertions while they are developing their app but I also want to allow them to use our static library in release mode so they don't have to submit their app to the App Store…
Steve Moser
  • 7,647
  • 5
  • 55
  • 94
0
votes
0 answers

NSAssert not called in debug mode

I received a big iOS project, in this project every NSAssert() are skipped even in debug! I added a test to check is NS_BLOCK_ASSERTIONS is defined even in debug mode and no, it isn't defined. #ifdef NS_BLOCK_ASSERTION NSLog(@"Assertion are…
IgnazioC
  • 4,554
  • 4
  • 33
  • 46
0
votes
1 answer

fetcherWithRequest:fetcherClass not found

I am getting a warning in my GTMHTTPUploadFetcher.m file that says "-fetcherWithRequest:fetcherClass" not found (return type defaults to "id") for this code + (GTMHTTPUploadFetcher *)uploadFetcherWithRequest:(NSURLRequest *)request …
user1114881
  • 731
  • 1
  • 12
  • 25
0
votes
1 answer

NSInternalInconsistencyException' 'GL_CLAMP_TO_EDGE should be used in NPOT dimensions'

I just upgraded my project from Kobold2d 1.1.2 to 2.0.4 and now every time I try to build I get this message. *** Assertion failure in -[CCTexture2D setTexParameters:], /Desktop…
Stephen
  • 499
  • 9
  • 28
1
2