objc[23601]: Object 0x12b090f0 of class __NSCFSet autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Why would the following code section print the leak error above?
+ (BOOL)getSkipFlag
{
NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
if ( ![defs objectForKey:_BOOK_ID] )
{
[defs setObject:@"yyyy" forKey:_BOOK_ID];
[defs synchronize];
}
if ( ![[defs objectForKey:_BOOK_ID] isEqualToString:@"xxxx"] )
{
return NO;
}
return skipFlag;
}
usage
if ( ![ClassXYZ getSkipFlag] )
....
I don't use a new thread so I should not have a new autorelease pool set up.
Note: NSString *temp = [[NSBundle mainBundle] pathForResource:_CONFIG_PLIST ofType:@"plist"];
- would print the same error
I am using iOS 5.1
Thanks for any insight.
UPDATE: ClassXYZ.m ... static BOOL skipFlag = NO;
setter: + (void)setSkipFlag:(BOOL)boolValue { skipFlag = boolValue; }
usage: [ClassXYZ setSkipFlag:YES];
used in static void convert_uri_to_file_name(struct mg_connection *conn, const char *uri, char *buf, size_t buf_len)
Omar you had a good point about where it is used. It turns out if I ClassXYZ's own instance methods for example, it works without errors.