Search code examples
xcodeswift2ios9crash-reportssymbolicatecrash

Couple of crash logs got me stumped


During testing 2 of my beta testers have reported crashes. These are the only 2 and both experience a different crash. I just can not see what is causing the crashes. I hoped if I post one here someone can nudge me in the right direction.

Incident Identifier: FE4706B0-96FB-4F6A-89A3-14965A89D4C9
Beta Identifier:     5AB9E26F-1DF9-4826-B9F4-D51E7529306E
Hardware Model:      iPhone7,2
Process:             AnApplication [356]
Path:                /private/var/mobile/Containers/Bundle/Application/C1F6D736-BB16-4604-965A-5AFED492B02C/We Motovlog.app/We Motovlog
Identifier:          com.aWebAddresss.We-Motovlog
Version:             1.0.8 (1.0)
Beta:                YES
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2015-10-01 21:13:21.21 +0100
Launch Time:         2015-10-01 21:12:53.53 +0100
OS Version:          iOS 9.0.1 (13A404)
Report Version:      105

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000b5224
Triggered by Thread:  0

Global Trace Buffer (reverse chronological seconds):
12.054284    CFNetwork                  0x000000018247d9a4 TCP Conn 0x15fdb5800 SSL Handshake DONE
12.240634    CFNetwork                  0x000000018247d8b4 TCP Conn 0x15fdb5800 starting SSL negotiation
12.241194    CFNetwork                  0x000000018251f760 TCP Conn 0x15fdb5800 complete. fd: 6, err: 0
12.242804    CFNetwork                  0x0000000182520c8c TCP Conn 0x15fdb5800 event 1. err: 0
12.329534    CFNetwork                  0x0000000182520d64 TCP Conn 0x15fdb5800 started
12.333102    CFNetwork                  0x00000001825765a4 Creating default cookie storage with default identifier
12.333102    CFNetwork                  0x0000000182576570 Faulting in CFHTTPCookieStorage singleton
12.333103    CFNetwork                  0x00000001825c8498 Faulting in NSHTTPCookieStorage singleton
14.578179    CFNetwork                  0x000000018247d9a4 TCP Conn 0x15fe98dd0 SSL Handshake DONE
14.769610    CFNetwork                  0x000000018247d8b4 TCP Conn 0x15fe98dd0 starting SSL negotiation
14.770747    CFNetwork                  0x000000018251f760 TCP Conn 0x15fe98dd0 complete. fd: 6, err: 0
14.772033    CFNetwork                  0x0000000182520c8c TCP Conn 0x15fe98dd0 event 1. err: 0
14.854070    CFNetwork                  0x0000000182520d64 TCP Conn 0x15fe98dd0 started
15.166164    CFNetwork                  0x000000018247d9a4 TCP Conn 0x15fd7e620 SSL Handshake DONE
15.549554    CFNetwork                  0x000000018247d8b4 TCP Conn 0x15fd7e620 starting SSL negotiation
15.550051    CFNetwork                  0x000000018251f760 TCP Conn 0x15fd7e620 complete. fd: 6, err: 0
15.551401    CFNetwork                  0x0000000182520c8c TCP Conn 0x15fd7e620 event 1. err: 0
15.640146    CFNetwork                  0x0000000182520d64 TCP Conn 0x15fd7e620 started
27.110642    CFNetwork                  0x000000018247d9a4 TCP Conn 0x15fda0c10 SSL Handshake DONE
27.397462    CFNetwork                  0x000000018247d8b4 TCP Conn 0x15fda0c10 starting SSL negotiation
27.397862    CFNetwork                  0x000000018251f760 TCP Conn 0x15fda0c10 complete. fd: 6, err: 0
27.398833    CFNetwork                  0x0000000182520c8c TCP Conn 0x15fda0c10 event 1. err: 0
27.651662    CFNetwork                  0x0000000182520d64 TCP Conn 0x15fda0c10 started

Thread 0 name:
Thread 0 Crashed:
0   We Motovlog                     0x00000001000b5224 RegisterViewController.insertUserConfirmedIntoDatabase() -> () (RegisterViewController.swift:0)
1   We Motovlog                     0x00000001000be268 RegisterViewController.(selectTwitterAccount(RegisterViewController) -> (NSNotification) -> ()).(closure #1).(closure #2) (RegisterViewController.swift:312)
2   UIKit                           0x000000018871f19c -[UIAlertController _fireOffActionOnTargetIfValidForAction:] + 100 (UIAlertController.m:1008)
3   UIKit                           0x000000018871f934 __85-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:]_block_invoke + 32 (UIAlertController.m:1142)
4   UIKit                           0x0000000188617c10 -[UIPresentationController transitionDidFinish:] + 1320 (UIPresentationController.m:294)
5   UIKit                           0x000000018861adf8 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 188 (UIPresentationController.m:738)
6   UIKit                           0x00000001883fb0a4 -[_UIViewControllerTransitionContext completeTransition:] + 116 (UIViewControllerTransitioning.m:236)
7   UIKit                           0x0000000188309828 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 628 (UIView.m:9265)
8   UIKit                           0x0000000188309324 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312 (UIView.m:1271)
9   UIKit                           0x00000001883091ac -[UIViewAnimationState animationDidStop:finished:] + 108 (UIView.m:1310)
10  QuartzCore                      0x0000000187ad9040 CA::Layer::run_animation_callbacks(void*) + 284 (CALayer.mm:6653)
11  libdispatch.dylib               0x0000000198165770 _dispatch_client_callout + 16 (object.m:513)
12  libdispatch.dylib               0x000000019816ae20 _dispatch_main_queue_callback_4CF + 1844 (inline_internal.h:1063)
13  CoreFoundation                  0x0000000182d30258 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1615)
14  CoreFoundation                  0x0000000182d2e0c0 __CFRunLoopRun + 1628 (CFRunLoop.c:2721)
15  CoreFoundation                  0x0000000182c5cdc0 CFRunLoopRunSpecific + 384 (CFRunLoop.c:2814)
16  GraphicsServices                0x000000018ddb0088 GSEventRunModal + 180 (GSEvent.c:2247)
17  UIKit                           0x0000000188336f60 UIApplicationMain + 204 (UIApplication.m:3663)
18  We Motovlog                     0x00000001000c14c0 main (AppDelegate.swift:19)
19  libdyld.dylib                   0x00000001981968b8 start + 4 (start_glue.s:80)

And the code that it appears to be crashing on.

func insertUserConfirmedIntoDatabase(){

    let defaults = NSUserDefaults.standardUserDefaults()
    defaults.synchronize()

    var parameters = ""

    if let YouTubeChannelID = defaults.valueForKey("YTchannelID"){
        parameters = "YouTubeChannelID=\(YouTubeChannelID)&"
    }

    if let  TwitterID = defaults.valueForKey("chosenTwitterID"){
        parameters = parameters.stringByAppendingString("TwitterID=\(TwitterID)&")
    }

    if      let Subscribers = defaults.valueForKey("YTchannelsubscriberCount"){
        parameters = parameters.stringByAppendingString("Subscribers=\(Subscribers)&")
    }

    if  let VloggerYouTubeName = defaults.valueForKey("YTchannelName"){
        parameters = parameters.stringByAppendingString("VloggerYouTubeName=\(VloggerYouTubeName)&")        }


    if let VloggersEmail = defaults.valueForKey("usersEmail"){
        parameters = parameters.stringByAppendingString("VloggersEmail=\(VloggersEmail)&")
    }

    if let  VloggersUserID = defaults.valueForKey("userGoogleID"){
        parameters = parameters.stringByAppendingString("VloggersUserID=\(VloggersUserID)&")
    }

    if  let VloggersCountry = defaults.valueForKey("YTchannelCountry"){
        parameters = parameters.stringByAppendingString("VloggersCountry=\(VloggersCountry)&")
    }

    if  let VloggerYouTubeTitle = defaults.valueForKey("YTchannelTitle"){
        parameters = parameters.stringByAppendingString("VloggerYouTubeTitle=\(VloggerYouTubeTitle)")
    }


    let url = NSURL(string: "https://website.com/TMVUKApp/updateProfile.php?\(parameters)")!
    print("if let params \(url)")


    let request = NSURLRequest(URL: url)

    let session = NSURLSession.sharedSession()

    let task = session.dataTaskWithRequest(request) {

        (data, response, error) -> Void in

        if error == nil{

            self.performSegueWithIdentifier("loggedInSegue", sender: nil)
        }
    }

    task.resume()

}

and the code that calls

insertUserConfirmedIntoDatabase()

func selectTwitterAccount(notification: NSNotification){


        let selectTwitterAccount = UIAlertController(title: "Select the account associated with your youTube persona", message: "", preferredStyle: .Alert)
        let receivedDictionary = notification.userInfo!
        let arrayOfUsernames = receivedDictionary["usernames"] as! NSArray
        NSNotificationCenter.defaultCenter().removeObserver(self, name: "selectTwitterAccountNotification", object: nil)
        for username in arrayOfUsernames{
            selectTwitterAccount.addAction(UIAlertAction(title: username.username, style: UIAlertActionStyle.Default, handler: { (alertAction) -> Void in
                NSUserDefaults.standardUserDefaults().setValue(username.username!, forKey: "chosenTwitterID")
                NSUserDefaults.standardUserDefaults().setBool(true, forKey: "userhasConfirmedProfile")
                NSUserDefaults.standardUserDefaults().synchronize()

                self.insertUserConfirmedIntoDatabase()

            }))

        }
        selectTwitterAccount.addAction(UIAlertAction(title: "No twitter", style:UIAlertActionStyle.Destructive, handler: { (UIAlertAction) -> Void in
            NSUserDefaults.standardUserDefaults().setBool(true, forKey: "userhasConfirmedProfile")
            NSUserDefaults.standardUserDefaults().synchronize()
            self.insertUserConfirmedIntoDatabase()
        }))
    dispatch_async(dispatch_get_main_queue(), {
        self.presentViewController(selectTwitterAccount, animated: true) { () -> Void in


        }
    })
}

This is one of the crashes that is only happening to 1 user. I first thought it may be down to some of the NSUserDefaults not being set but I've handled those with if let statements but still it crashes.

As always any help will be gratefully received in helping me debug this problem. Why does it crash?


Solution

  • My guess is something to do with the session.dataTaskWithRequest() call. Try getting your app into a state right before that code would be called, then shut off all your internet connections and perform whatever action you would to trigger that code to run. That will 'simulate' a lost connection in the middle of using the app.