UIApplicationMain crashing in xcode

-7

My application is crashing as

#import <UIKit/UIKit.h>

int main(int argc, char *argv[])
{

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);      //Thread 1:signal SIGABRT
    [pool release];
    return retVal;

    /*
    int retVal = 0;
    @autoreleasepool {
        NSString *classString = NSStringFromClass([gTalkAppDelegate class]);
        @try {
            retVal = UIApplicationMain(argc, argv, nil, classString);
        }
        @catch (NSException *exception) {
            NSLog(@"Exception - %@",[exception description]);
            exit(EXIT_FAILURE);
        }
    }
    return retVal;
    */
}


2014-01-07 15:41:25.881 testproject[28812:70b] -[__NSCFConstantString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x281d184
2014-01-07 15:41:25.973 testproject[28812:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x281d184'
*** First throw call stack:
(
    0   CoreFoundation                      0x026d75e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x01c028b6 objc_exception_throw + 44
    2   CoreFoundation                      0x02774903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x026c790b ___forwarding___ + 1019
    4   CoreFoundation                      0x026c74ee _CF_forwarding_prep_0 + 14
    5   testproject                        0x0000e7cd -[SecondViewController showData] + 1837
    6   testproject                        0x0000829d -[SecondViewController viewDidAppear:] + 1261
    7   UIKit                               0x0087ac48 -[UIViewController _setViewAppearState:isAnimating:] + 497
    8   UIKit                               0x0087b1d7 -[UIViewController __viewDidAppear:] + 146
    9   UIKit                               0x00898fca -[UINavigationController viewDidAppear:] + 191
    10  UIKit                               0x0087ac48 -[UIViewController _setViewAppearState:isAnimating:] + 497
    11  UIKit                               0x0087b1d7 -[UIViewController __viewDidAppear:] + 146
    12  UIKit                               0x008a827b -[UITabBarController viewDidAppear:] + 113
    13  UIKit                               0x0087ac48 -[UIViewController _setViewAppearState:isAnimating:] + 497
    14  UIKit                               0x0087b1d7 -[UIViewController __viewDidAppear:] + 146
    15  UIKit                               0x0087cb9f __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 44
    16  UIKit                               0x0087b56a -[UIViewController _executeAfterAppearanceBlock] + 63
    17  UIKit                               0x007801a9 ___afterCACommitHandler_block_invoke_2 + 33
    18  UIKit                               0x0078012e _applyBlockToCFArrayCopiedToStack + 403
    19  UIKit                               0x0077ff7e _afterCACommitHandler + 568
    20  CoreFoundation                      0x0269f4ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    21  CoreFoundation                      0x0269f41f __CFRunLoopDoObservers + 399
    22  CoreFoundation                      0x0267d344 __CFRunLoopRun + 1076
    23  CoreFoundation                      0x0267cac3 CFRunLoopRunSpecific + 467
    24  CoreFoundation                      0x0267c8db CFRunLoopRunInMode + 123
    25  GraphicsServices                    0x035e09e2 GSEventRunModal + 192
    26  GraphicsServices                    0x035e0809 GSEventRun + 104
    27  UIKit                               0x00763d3b UIApplicationMain + 1225
    28  testproject                        0x0000213d main + 125
    29  testproject                        0x000020b5 start + 53
    30  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

How can fix it.

ios
iphone
objective-c
xcode
asked on Stack Overflow Jan 7, 2014 by MaxEcho • edited Nov 10, 2015 by MaxEcho

2 Answers

3

Looking through your stacktrace you can see that in viewDidAppear you call a method called showData this can be seen from the two lines below.

5   gtalkhotdial   0x0000e7cd -[SecondViewController showData] + 1837
6   gtalkhotdial   0x0000829d -[SecondViewController viewDidAppear:] + 1261

Within this showData method you make a call to something (unfortunately we can't tell what) that tries to call -[__NSCFConstantString countByEnumeratingWithState:objects:count:]: and what ever that object is it, it doesn't have this method. To tell you anything more we need to see what is in the method showData. But your crash is clearly happening in there. If you what to know anything else please share that method implementation.

answered on Stack Overflow Jan 7, 2014 by Popeye • edited Jan 7, 2014 by Matthias Bauch
0

Look at your stack trace, the lines

 2   CoreFoundation                      0x02774903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275

and

5   gtalkhotdial                        0x0000e7cd -[SecondViewController showData] + 1837

should help you

answered on Stack Overflow Jan 7, 2014 by KIDdAe

User contributions licensed under CC BY-SA 3.0