1

Recently updated my iPhone and Xcode and I'm having some problems running my app on my physical device. When I run it on the simulator built into Xcode it runs fine, no drama.

However, when I launch it on my physical device it crashes, with no error code apart from:

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

Crash Message Example Output right before it crashes (by the crash, I just mean it proceeds to land on an empty white page):

2018-04-14 20:34:17.840760+1200 MPM[1520:450438] 4.11.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40100000 started
2018-04-14 20:34:17.840831+1200 MPM[1520:450438] 4.11.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
2018-04-14 20:34:18.603581+1200 MPM[1520:450344] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-04-14 20:34:18.605545+1200 MPM[1520:450344] [MC] Reading from public effective user settings.
2018-04-14 20:34:18.635084+1200 MPM[1520:450442] TIC Read Status [3:0x0]: 1:57
2018-04-14 20:34:18.635136+1200 MPM[1520:450442] TIC Read Status [3:0x0]: 1:57
2018-04-14 20:34:18.848190+1200 MPM[1520:450455] TIC Read Status [1:0x0]: 1:57
2018-04-14 20:34:18.848245+1200 MPM[1520:450455] TIC Read Status [1:0x0]: 1:57
2018-04-14 20:34:19.214792+1200 MPM[1520:450438] TIC Read Status [5:0x0]: 1:57
2018-04-14 20:34:19.214887+1200 MPM[1520:450438] TIC Read Status [5:0x0]: 1:57
2018-04-14 20:34:19.224559+1200 MPM[1520:450438] TIC Read Status [4:0x0]: 1:57
2018-04-14 20:34:19.224638+1200 MPM[1520:450438] TIC Read Status [4:0x0]: 1:57
2018-04-14 20:34:29.910232+1200 MPM[1520:450344] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-04-14 20:34:29.914038+1200 MPM[1520:450445] TIC Read Status [6:0x0]: 1:57
2018-04-14 20:34:29.914066+1200 MPM[1520:450445] TIC Read Status [6:0x0]: 1:57
2018-04-14 20:34:30.533306+1200 MPM[1520:450442] TIC Read Status [7:0x0]: 1:57
2018-04-14 20:34:30.533410+1200 MPM[1520:450442] TIC Read Status [7:0x0]: 1:57
2018-04-14 20:34:30.659726+1200 MPM[1520:450619] TIC Read Status [8:0x0]: 1:57
2018-04-14 20:34:30.659861+1200 MPM[1520:450619] TIC Read Status [8:0x0]: 1:57
2018-04-14 20:34:31.336759+1200 MPM[1520:450551] TIC Read Status [9:0x0]: 1:57
2018-04-14 20:34:31.336833+1200 MPM[1520:450551] TIC Read Status [9:0x0]: 1:57
2018-04-14 20:34:35.499882+1200 MPM[1520:450551] TIC Read Status [10:0x0]: 1:57
2018-04-14 20:34:35.499977+1200 MPM[1520:450551] TIC Read Status [10:0x0]: 1:57
2018-04-14 20:34:37.613908+1200 MPM[1520:450619] TIC Read Status [2:0x1d416ff00]: 1:57
2018-04-14 20:34:37.613974+1200 MPM[1520:450619] TIC Read Status [2:0x1d416ff00]: 1:57
(lldb) 

Anyone have any ideas here? I'm completely stumped at this point. Even any way of finding a more detailed crash message!

Managed to get this output after rebooting the physical device and running again

018-04-14 20:49:32.065664+1200 MPM[259:6493] 4.11.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40100000 started
2018-04-14 20:49:32.065727+1200 MPM[259:6493] 4.11.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
2018-04-14 20:49:32.313875+1200 MPM[259:6335] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-04-14 20:49:32.314851+1200 MPM[259:6335] [MC] Reading from public effective user settings.
2018-04-14 20:49:32.629858+1200 MPM[259:6496] TIC Read Status [1:0x0]: 1:57
2018-04-14 20:49:32.629930+1200 MPM[259:6496] TIC Read Status [1:0x0]: 1:57
2018-04-14 20:49:32.769607+1200 MPM[259:6496] TIC Read Status [2:0x0]: 1:57
2018-04-14 20:49:32.769667+1200 MPM[259:6496] TIC Read Status [2:0x0]: 1:57
2018-04-14 20:49:36.901270+1200 MPM[259:6496] [] tcp_timers tcp[3] retransmit SYN 3
2018-04-14 20:49:36.983026+1200 MPM[259:6496] [] tcp_timers tcp[3] retransmit SYN 4
2018-04-14 20:49:37.065395+1200 MPM[259:6496] [] tcp_timers tcp[3] retransmit SYN 5
2018-04-14 20:49:37.144244+1200 MPM[259:6496] [] tcp_timers tcp[3] retransmit SYN 6
2018-04-14 20:49:37.305612+1200 MPM[259:6496] [] tcp_timers tcp[3] retransmit SYN 7
2018-04-14 20:49:37.620292+1200 MPM[259:6496] [] tcp_timers tcp[3] retransmit SYN 8
2018-04-14 20:49:38.213878+1200 MPM[259:6335] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x13c870600>)
2018-04-14 20:49:42.662630+1200 MPM[259:6496] TIC Read Status [3:0x0]: 1:57
2018-04-14 20:49:42.662738+1200 MPM[259:6496] TIC Read Status [3:0x0]: 1:57
2018-04-14 20:49:43.125171+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 3
2018-04-14 20:49:43.207601+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 4
2018-04-14 20:49:43.290081+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 5
2018-04-14 20:49:43.369637+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 6
2018-04-14 20:49:43.530976+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 7
2018-04-14 20:49:43.846252+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 8
2018-04-14 20:49:44.475763+1200 MPM[259:6521] [] tcp_timers tcp[4] retransmit SYN 9
2018-04-14 20:49:47.529539+1200 MPM[259:6493] [] tcp_timers tcp[5] retransmit SYN 3
2018-04-14 20:49:47.603154+1200 MPM[259:6493] [] tcp_timers tcp[5] retransmit SYN 4
2018-04-14 20:49:47.679578+1200 MPM[259:6493] [] tcp_timers tcp[5] retransmit SYN 5
2018-04-14 20:49:47.756423+1200 MPM[259:6493] [] tcp_timers tcp[5] retransmit SYN 6
2018-04-14 20:49:47.905496+1200 MPM[259:6493] [] tcp_timers tcp[5] retransmit SYN 7
2018-04-14 20:49:48.257627+1200 MPM[259:6491] TIC Read Status [4:0x0]: 1:57
2018-04-14 20:49:48.257731+1200 MPM[259:6491] TIC Read Status [4:0x0]: 1:57
2018-04-14 20:49:49.175122+1200 MPM[259:6491] TIC Read Status [5:0x0]: 1:57
2018-04-14 20:49:49.175221+1200 MPM[259:6491] TIC Read Status [5:0x0]: 1:57
2018-04-14 20:50:13.674495+1200 MPM[259:6702] TIC Read Status [6:0x0]: 1:57
2018-04-14 20:50:13.674595+1200 MPM[259:6702] TIC Read Status [6:0x0]: 1:57
2018-04-14 20:50:21.735145+1200 MPM[259:6736] TIC Read Status [9:0x0]: 1:57
2018-04-14 20:50:21.735254+1200 MPM[259:6736] TIC Read Status [9:0x0]: 1:57
2018-04-14 20:50:22.448789+1200 MPM[259:6335] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-04-14 20:50:22.449513+1200 MPM[259:6335] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-04-14 20:50:23.017697+1200 MPM[259:6493] TIC Read Status [10:0x0]: 1:57
2018-04-14 20:50:23.017805+1200 MPM[259:6493] TIC Read Status [10:0x0]: 1:57
2018-04-14 20:50:28.214627+1200 MPM[259:6491] TIC Read Status [11:0x0]: 1:57
2018-04-14 20:50:28.214717+1200 MPM[259:6491] TIC Read Status [11:0x0]: 1:57
2018-04-14 20:50:28.718297+1200 MPM[259:6335] [Snapshotting] Snapshotting a view (0x13f01c400, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.
2018-04-14 20:50:33.931411+1200 MPM[259:6335] +[CATransaction synchronize] called within transaction
2018-04-14 20:50:33.931806+1200 MPM[259:6335] +[CATransaction synchronize] called within transaction
2018-04-14 20:50:33.932168+1200 MPM[259:6335] +[CATransaction synchronize] called within transaction
2018-04-14 20:50:33.932495+1200 MPM[259:6335] +[CATransaction synchronize] called within transaction
2018-04-14 20:50:33.932496+1200 MPM[259:6521] TIC Read Status [8:0x1cc16f180]: 1:57
2018-04-14 20:50:33.932609+1200 MPM[259:6521] TIC Read Status [8:0x1cc16f180]: 1:57
(lldb) 

After Xcode gave me that output I believe its something to do with the way I am attempting to load the view of the view controller?

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    //Configure Firebase
    FirebaseApp.configure()
    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
    //Create window and assign root view controller, since not using storyboard
    window = UIWindow()
    let vc = MainTabBarController()
    window?.rootViewController = vc
    window?.makeKeyAndVisible()
    return true
}

After following the advice of adding breakpoints I was able to find out that the app never makes it past line 171 below:

code with breakpoints where error ocurrs

Cheers

Harry
  • 163
  • 10
  • 1
    The above explanation won't give the solution. Just place the breakpoints in various place and track the crash point. Then identify the block of code which leads to the crash. Then update your question here. – Mani Apr 14 '18 at 08:51
  • 1
    Set an exception breakpoint, but you have probably force unwrapped a nil. Do you try and access files or anything that may work on the simulator but fail on a real device? – Paulw11 Apr 14 '18 at 08:52
  • Thanks for the suggestion, I believe I have found where it is crashing, makes it past line 160 in the latest picture but never past 171. – Harry Apr 14 '18 at 09:07
  • Did you set an exception breakpoint? – Paulw11 Apr 14 '18 at 09:11
  • @Paulw11 yeah I added an "All exceptions" exception breakpoint and didn't get any output in log – Harry Apr 14 '18 at 09:16
  • 1
    There is a warning about attempting to load the view of a view controller that is being deallocated. Check you aren't allocating a view controller as a local variable that goes out of scope before it can be presented. – Paulw11 Apr 14 '18 at 09:25
  • 1
    I am pretty sure that you made a mistake in you custom FB authentication logic. In either case, your app crashes somewhere within the logIn method of your LoginManager. Add breakpoints in that method and let us know which line crashes – Andriy Gordiychuk Apr 14 '18 at 10:37
  • @AndriyGordiychuk it crashes when it hits line 170 – Harry Apr 14 '18 at 10:51
  • @Harry that's what I said. It starts executing the `logIn` method and crashes. Go to that method and identify which line causes the crash. So far we only know that it happens within that method and that completion handler passed to `logIn` is not called – Andriy Gordiychuk Apr 14 '18 at 10:52
  • @AndriyGordiychuk it is a FacebookLogin method, not my own :( – Harry Apr 14 '18 at 11:20
  • @Harry `logIn(withReadPermissions: [], from: presentingViewController)` is a facebook method. You have `logIn(withReadPermissions: [], viewController: presentingViewController)`. Besides, if it was facebook method you'd initialise your login manager as `FBSDKLoginManager` not `LoginManager` – Andriy Gordiychuk Apr 14 '18 at 11:24

0 Answers0