0

I've just a crash report appear in iTunes Connect, so I've loaded it into Xcode, which symbolicated it for me.

The relevant portion is:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x323e188f __exceptionPreprocess + 163
1   libobjc.A.dylib                 0x34437259 objc_exception_throw + 33
2   CoreFoundation                  0x323e1789 +[NSException raise:format:] + 1
3   CoreFoundation                  0x323e17ab +[NSException raise:format:] + 35
4   Bitrate Tester                  0x00048435 0x0001a435
5   Bitrate Tester                  0x00031473 -[FirstViewController viewDidLoad] (FirstViewController.m:27)

FirstViewController, is, not surprisingly, the first view controller my app shows, meaning that [FirstViewController viewDidLoad] is basically the first actual method called in my app. Therefore there isn't much potential for something being wrong called before.

Now, this is how viewDidLoad looks:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    DefaultSHKConfigurator *configurator = [[MySHKConfigurator alloc] init];
    [SHKConfiguration sharedInstanceWithConfigurator:configurator];
    [SHK setFavorites:[NSArray arrayWithObjects:@"SHKFacebook",@"SHKTwitter",@"SHKMail",nil] forType:SHKShareTypeText];
}

Line 27 is

    [SHKConfiguration sharedInstanceWithConfigurator:configurator];

So, is ShareKit causing a crash in my app?? Note that I have not been able to reproduce the issue on any of my devices (I tested in the iOS Simulator, my iPhone 4 on iOS 5.1.1, an iPad 2 on iOS 5.1.1, and an iPhone 3GS on iOS 5.1.1). Any thoughts?

houbysoft
  • 32,532
  • 24
  • 103
  • 156
  • definitely looks like a sharekit issue. Could somehow be related to [this issue](https://github.com/ShareKit/ShareKit/issues/321). Looks like it was reported but never fixed because of difficulty to reproduce. – Dima Jun 19 '12 at 16:01

1 Answers1

1

I think first method called in your app is applicationDidFinishLaunchingWithOptions: in your app delegate, not viewDidLoad.

It can happen sometimes, that your view is unloaded (e.g. because of low memory), and then loaded again. This time configurator might get loaded twice, which is bad.

So the solution might be to move ShareKit configuration to applicationDidFinishLaunchingWithOptions, as stated in configuration wiki. This method is guaranteed to be called only once.

Vilém Kurz
  • 3,401
  • 2
  • 34
  • 43
  • I could see this making sense, I'll try to move it and see if the crashes persist... Gave you +1 in the meantime. – houbysoft Jun 19 '12 at 20:14