I have submitted my app to review and apple got back to me saying it crashes in launch. I got the .app file submitted to apple, and I installed it on the simulator.
xcrun simctl install booted /Users/venkatanandamuri/Desktop/prod\ crash/Myapp.app
It indeed crashed on launch.
The Mac console log shows nothing about the crash on simulator.
I got the crash log from Xcode device logs:
Last Exception Backtrace:
0 CoreFoundation 0x1d590a3a8 __exceptionPreprocess + 232
1 libobjc.A.dylib 0x1d4b0fd00 objc_exception_throw + 59
2 CoreFoundation 0x1d58229f8 -[NSObject+ 223736 (NSObject) doesNotRecognizeSelector:] + 143
3 CoreFoundation 0x1d590fd54 ___forwarding___ + 1411
4 CoreFoundation 0x1d5911b50 _CF_forwarding_prep_0 + 95
5 FBSDKCoreKit 0x105f67530 0x105f24000 + 275760
6 FBSDKCoreKit 0x105f673ac 0x105f24000 + 275372
7 FBSDKCoreKit 0x105f2df28 0x105f24000 + 40744
8 FBSDKCoreKit 0x105f2b0b0 0x105f24000 + 28848
9 FBSDKCoreKit 0x105f2afbc 0x105f24000 + 28604
10 FBSDKCoreKit 0x105f70fe0 0x105f24000 + 315360
11 FBSDKCoreKit 0x105f7078c 0x105f24000 + 313228
12 FBSDKCoreKit 0x105f2bb28 0x105f24000 + 31528
13 FBSDKCoreKit 0x105f34cac 0x105f24000 + 68780
14 Foundation 0x1d638115c __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_2 + 27
15 CoreFoundation 0x1d5878acc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 27
16 CoreFoundation 0x1d5878a8c ___CFXRegistrationPost_block_invoke + 67
17 CoreFoundation 0x1d5877f30 _CFXRegistrationPost + 419
18 CoreFoundation 0x1d5877bbc ___CFXNotificationPost_block_invoke + 99
19 CoreFoundation 0x1d57ee768 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1503
20 CoreFoundation 0x1d5877664 _CFXNotificationPost + 715
21 Foundation 0x1d62727c4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 71
22 UIKitCore 0x202bd2398 -[UIApplication _stopDeactivatingForReason:] + 1339
23 UIKitCore 0x20247010c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 487
24 UIKitCore 0x202470e5c _performActionsWithDelayForTransitionContext + 119
25 UIKitCore 0x20246feb8 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 259
26 UIKitCore 0x202474ea8 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 363
27 UIKitCore 0x2027bb904 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 479
28 FrontBoardServices 0x1d82ccc58 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_3 + 243
29 libdispatch.dylib 0x1d5319884 _dispatch_client_callout + 19
30 libdispatch.dylib 0x1d531ce5c _dispatch_block_invoke_direct + 251
31 FrontBoardServices 0x1d830918c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 47
32 FrontBoardServices 0x1d8308e08 -[FBSSerialQueue _performNext] + 435
33 FrontBoardServices 0x1d8309404 -[FBSSerialQueue _performNextFromRunLoopSource] + 55
34 CoreFoundation 0x1d589a444 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 27
35 CoreFoundation 0x1d589a3c0 __CFRunLoopDoSource0 + 91
36 CoreFoundation 0x1d5899c7c __CFRunLoopDoSources0 + 179
37 CoreFoundation 0x1d5894950 __CFRunLoopRun + 987
38 CoreFoundation 0x1d5894254 CFRunLoopRunSpecific + 451
39 GraphicsServices 0x1d7ad3d8c GSEventRunModal + 107
40 UIKitCore 0x202bdc4c0 UIApplicationMain + 215
41 MyApp 0x104d97148 0x104d90000 + 29000
42 libdyld.dylib 0x1d5350fd8 start + 3
and I symbolicated the crash log , I found:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001f1be50dc 0x1f1bc2000 + 143580
points to
NSNotificationName.TimeOutUserInteraction.unsafeMutableAddressor (in MyApp) (InterractionUIApplication.swift:0)
I commented out the lines related to this notification, and the app got approved.
Surprisingly the code related to this would not get called on app launch. There is no possibility, as I searched the codebase, and this code would only be called during a sign in process but NOT ON app launch.
I wonder why it crashes, and why it didn't after I commented out the code.
Code related to this notification:
import UIKit
// User Activity Timer
extension NSNotification.Name {
public static let TimeOutUserInteraction: NSNotification.Name = NSNotification.Name(rawValue: "TimeOutUserInteraction")
}
class InterractionUIApplication: UIApplication {
static let timeoutInSeconds: TimeInterval = 60 * 10 // 10 minutes
private var idleTimer: Timer?
private var enabledUserInteractionTracking: Bool = false
func startUserInternactionTracking() {
enabledUserInteractionTracking = true
resetIdleTimer()
}
func stopUserInternactionTracking() {
enabledUserInteractionTracking = false
if let idleTimer = idleTimer {
idleTimer.invalidate()
}
idleTimer = nil
}
// Resent the timer because there was user interaction.
func resetIdleTimer() {
if let idleTimer = idleTimer {
idleTimer.invalidate()
}
idleTimer = Timer.scheduledTimer(timeInterval: InterractionUIApplication.timeoutInSeconds, target: self, selector: #selector(idleTimerExceeded), userInfo: nil, repeats: false)
}
// If the timer reaches the limit as defined in timeoutInSeconds, post this notification.
#objc func idleTimerExceeded() {
NotificationCenter.default.post(name: Notification.Name.TimeOutUserInteraction, object: nil)
}
}
and in MyAppManager class:
func startUserInternactionTracking()
{
(UIApplication.shared as? InterractionUIApplication)?.startUserInternactionTracking()
NotificationCenter.default.addObserver(self, selector: #selector(onTimeOutUserInteraction), name: Notification.Name.TimeOutUserInteraction, object: nil) //This is the commented out line to make review successful
}
func stopUserInternactionTracking()
{
(UIApplication.shared as? InterractionUIApplication)?.stopUserInternactionTracking()
NotificationCenter.default.removeObserver(self, name: Notification.Name.TimeOutUserInteraction, object: nil)
}
I'm sure that startUserInternactionTracking is not called during app launch. But I wonder why this is the reason for crash ?
In AppDelegate, I initialize the manager class:
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var appManager = MyAppManager()
.....
}
Please not this crash only happened on the device apple tested. The pre-prod build worked as expected in all of our test devices .I'm lack of experience to debug this kind of crash. I've never seen this before.
Can someone point me in right direction ?
Subclassing UIApplication looks like a possible cause. According to the documentation
Subclassing Notes
Most apps do not need to subclass UIApplication. Instead, use an app delegate to > manage interactions between the system and the app.
If your app must handle incoming events before the system does—a very rare
situation—you can implement a custom event or action dispatching mechanism. To do > this, subclass UIApplication and override the sendEvent(:) and/or the
sendAction(:to:from:for:) methods. For every event you intercept, dispatch it
back to the system by calling [super sendEvent:event] after you handle the event. > Intercepting events is only rarely required and you should avoid it if possible.
Are you actually instantiating that subclass instead of UIApplication? To do this you would need to create a main.swift file and call UIApplicationMain(,,,) and remove the default #UIApplicationMain macro from the top of your UIApplicationDelegate subclass.
But as the docs say, it doesn't seem like you actually need to subclass UIApplication, I suggest you look into the "coordinator" pattern instantiate an AppController class from your app delegate that manages app level logic.
Related
I'm new in XCode and I'm trying to create a simple Webview that displays www.google.com website
But the Code does not RUN. I got an Error: Threat1: Signal SIGATBRT
Here is my code:
import UIKit
import WebKit
class ViewController: UIViewController {
#IBOutlet var WebView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "www.google.com")
let request = URLRequest(url: url!)
WebView.load(request)
// Do any additional setup after loading the view.
}
}
Questions Update
import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { // <- The Error Pointing Here!!! -> Threat1: Signal SIGABRT
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Output Text
2020-01-16 09:58:27.127224+0200 wvApp2[6306:366786] -[__NSArrayM loadRequest:]: unrecognized selector sent to instance 0x600001f0c3c0
2020-01-16 09:59:21.186755+0200 wvApp2[6306:366786] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM loadRequest:]: unrecognized selector sent to instance 0x600001f0c3c0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 wvApp2 0x00000001038677ea $s6wvApp214ViewControllerC11viewDidLoadyyF + 890
6 wvApp2 0x0000000103867a8b $s6wvApp214ViewControllerC11viewDidLoadyyFTo + 43
7 UIKitCore 0x00007fff47a0ef01 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
8 UIKitCore 0x00007fff47a13e5a -[UIViewController loadViewIfRequired] + 1084
9 UIKitCore 0x00007fff47a14277 -[UIViewController view] + 27
10 UIKitCore 0x00007fff480ca3cf -[UIWindow addRootViewControllerViewIfPossible] + 150
11 UIKitCore 0x00007fff480c9ac0 -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 232
12 UIKitCore 0x00007fff480cab43 -[UIWindow _setHidden:forced:] + 362
13 UIKitCore 0x00007fff480ddef1 -[UIWindow _mainQueue_makeKeyAndVisible] + 42
14 UIKitCore 0x00007fff482e9431 -[UIWindowScene _makeKeyAndVisibleIfNeeded] + 202
15 UIKitCore 0x00007fff4761d445 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1405
16 UIKitCore 0x00007fff4808f170 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1018
17 UIKitCore 0x00007fff4808f4b2 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 304
18 UIKitCore 0x00007fff47bfa7f5 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
19 FrontBoardServices 0x00007fff365d6165 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
20 FrontBoardServices 0x00007fff365fc4d8 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
21 FrontBoardServices 0x00007fff365e0c45 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
22 FrontBoardServices 0x00007fff365fc169 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
23 libdispatch.dylib 0x0000000103b91d48 _dispatch_client_callout + 8
24 libdispatch.dylib 0x0000000103b94cb9 _dispatch_block_invoke_direct + 300
25 FrontBoardServices 0x00007fff3662237e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x00007fff3662206c -[FBSSerialQueue _queue_performNextIfPossible] + 441
27 FrontBoardServices 0x00007fff3662257b -[FBSSerialQueue _performNextFromRunLoopSource] + 22
28 CoreFoundation 0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76
30 CoreFoundation 0x00007fff23bd3bcc __CFRunLoopDoSources0 + 268
31 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263
32 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
33 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
34 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
35 wvApp2 0x00000001038689bb main + 75
36 libdyld.dylib 0x00007fff5227ec25 start + 1
37 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This is the Output text from All Output Window. I think this will help to clear out all misunderstandings on this question. This output is from the Run of the app till the exception.
Recent Issues
Showing Recent Issues
Build target wvApp2 of project wvApp2 with configuration Debug
CompileStoryboard /Users/admin/DevSource/wvApp2/wvApp2/Base.lproj/Main.storyboard (in target 'wvApp2' from project 'wvApp2')
cd /Users/admin/DevSource/wvApp2
export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
/Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --module wvApp2 --output-partial-info-plist /Users/admin/Library/Developer/Xcode/DerivedData/wvApp2-ehhbosgmbdwuucejiweipdfuqjzt/Build/Intermediates.noindex/wvApp2.build/Debug-iphonesimulator/wvApp2.build/Base.lproj/Main-SBPartialInfo.plist --auto-activate-custom-fonts --target-device iphone --target-device ipad --minimum-deployment-target 13.2 --output-format human-readable-text --compilation-directory /Users/admin/Library/Developer/Xcode/DerivedData/wvApp2-ehhbosgmbdwuucejiweipdfuqjzt/Build/Intermediates.noindex/wvApp2.build/Debug-iphonesimulator/wvApp2.build/Base.lproj /Users/admin/DevSource/wvApp2/wvApp2/Base.lproj/Main.storyboard
/* com.apple.ibtool.document.warnings */
/Users/admin/DevSource/wvApp2/wvApp2/Base.lproj/Main.storyboard:Bvy-8R-dSa: warning: UIWebView is deprecated since iOS 12.0 [7]
I don't know what I am doing wrong,
How can I solve this? Anyone answer is welcome.
First, you should better let variables start with a lowercase letter (and types with a uppercase). This is the kind-of-convetion in Swift (and Java and C++ and C and almost any other programming language except C#):
#IBOutlet var webView: WKWebView!
(change this using refactor in Xcode, to sync the storyboard/xib)
Then, don't use explicit unwrapping, better use if let:
if let url = URL(string: "www.google.com") {
let request = URLRequest(url: url)
webView.load(request)
}
To your exception: The only other thing (besides that the explicit url! unwrapping could fail) might be that the outlet webView is nil. You could also check this:
if (webView == nil) {
print ("Ooops")
}
If it's nil, check the connections from the storyboard/xib.
Make sure that you import webKit framework in your project target.
Target -> General -> Linked Framework and Libraries -> click on the + -> add the webKit.framwork
If you have done that and it's still not working please show more of the error message you are getting.
Also on a side note for naming convention you should not start class properties with uppercase.
Leading uppercase names are reserved for classes, this way you will always know if the code is referring to a class or a property. So in your case:
// #IBOutlet var WebView: WKWebView! change this to
#IBOutlet var webView: WKWebView!
I'm trying to upload an app to the iOS App Store but I'm getting rejection due to crashes (which I can't reproduce with the several simulations / devices I have.
I'm attaching here the crash reports.
The problem that I have is that I can't re-symbolicate the crash correctly and all I can get when I try to right click and choose re-symbolicate them is the following:
{"app_name":"Livycs","timestamp":"2019-10-21 13:36:46.22 -0700","app_version":"1.3","slice_uuid":"4ceb4db7-568a-3a47-a8e9-0e6d8ff33b2b","adam_id":1054637602,"build_version":"12","bundleID":"me.linktree.Livycs","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 13.1.3 (17A878)","incident_id":"B26974A6-3E7F-40F4-836A-BC4FF36D1219","name":"Livycs"}
Incident Identifier: B26974A6-3E7F-40F4-836A-BC4FF36D1219
CrashReporter Key: f76f6829cc13ca447c49f923305d7b23085e37fd
Hardware Model: xxx
Process: Livycs [394]
Path: /private/var/containers/Bundle/Application/1ADC7177-F01D-4C60-B624-730592A5C45A/Livycs.app/Livycs
Identifier: me.linktree.Livycs
Version: 12 (1.3)
AppStoreTools: 11A1002b
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: me.linktree.Livycs [530]
Date/Time: 2019-10-21 13:36:46.1480 -0700
Launch Time: 2019-10-21 13:34:25.7023 -0700
OS Version: iPhone OS 13.1.3 (17A878)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Last Exception Backtrace:
0 CoreFoundation 0x1a450298c __exceptionPreprocess + 220
1 libobjc.A.dylib 0x1a422b0a4 objc_exception_throw + 55
2 CoreFoundation 0x1a43f8054 +[NSException raise:format:] + 107
3 UIKitCore 0x1a7eb70f8 UISearchDisplayControllerNoLongerSupported + 247
4 UIKitCore 0x1a7eb73fc -[UISearchDisplayController initWithCoder:] + 83
5 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
6 UIFoundation 0x1a7aaba6c UINibDecoderDecodeObjectForValue + 1291
7 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
8 UIKitCore 0x1a7efe6e4 -[UIViewController initWithCoder:] + 1035
9 UIKitCore 0x1a81b9c2c -[UIClassSwapper initWithCoder:] + 2455
10 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
11 UIFoundation 0x1a7aaba6c UINibDecoderDecodeObjectForValue + 1291
12 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
13 UIKitCore 0x1a81b8edc -[NSCoder+ 6917852 (UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent:forKey:] + 315
14 UIKitCore 0x1a7efe89c -[UIViewController initWithCoder:] + 1475
15 UIKitCore 0x1a7e41a84 -[UITabBarController initWithCoder:] + 79
16 UIKitCore 0x1a81b9c2c -[UIClassSwapper initWithCoder:] + 2455
17 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
18 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
19 UIKitCore 0x1a81bdc50 -[UIRuntimeConnection initWithCoder:] + 127
20 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
21 UIFoundation 0x1a7aaba6c UINibDecoderDecodeObjectForValue + 1291
22 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
23 UIKitCore 0x1a81b8cc8 -[NSCoder+ 6917320 (UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 487
24 UIKitCore 0x1a81bb8b8 -[UINib instantiateWithOwner:options:] + 1111
25 UIKitCore 0x1a86617d8 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 287
26 Livycs 0x1040d44dc #objc WelcomeViewController.searchShowsAroundMeButtonClicked+ 165084 (_:) + 131
27 UIKitCore 0x1a8511a44 -[UIApplication sendAction:to:from:forEvent:] + 95
28 UIKitCore 0x1a7f556d0 -[UIControl sendAction:to:forEvent:] + 239
29 UIKitCore 0x1a7f55a34 -[UIControl _sendActionsForEvents:withEvent:] + 407
30 UIKitCore 0x1a7f54a50 -[UIControl touchesEnded:withEvent:] + 519
31 UIKitCore 0x1a854ad68 -[UIWindow _sendTouchesForEvent:] + 2323
32 UIKitCore 0x1a854c0a8 -[UIWindow sendEvent:] + 3351
33 UIKitCore 0x1a8528ae8 -[UIApplication sendEvent:] + 335
34 UIKitCore 0x1a85a023c __dispatchPreprocessedEventFromEventQueue + 5879
35 UIKitCore 0x1a85a2798 __handleEventQueueInternal + 4923
36 UIKitCore 0x1a859b60c __handleHIDEventFetcherDrain + 107
37 CoreFoundation 0x1a44807e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 23
38 CoreFoundation 0x1a4480738 __CFRunLoopDoSource0 + 79
39 CoreFoundation 0x1a447fed0 __CFRunLoopDoSources0 + 179
40 CoreFoundation 0x1a447b01c __CFRunLoopRun + 1079
41 CoreFoundation 0x1a447a8bc CFRunLoopRunSpecific + 463
42 GraphicsServices 0x1ae2e6328 GSEventRunModal + 103
43 UIKitCore 0x1a85106d4 UIApplicationMain + 1935
44 Livycs 0x1040d246c main + 156780 (SearchLocationViewController.swift:14)
45 libdyld.dylib 0x1a4305460 start + 3
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001a42faebc __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001a4216790 pthread_kill$VARIANT$mp + 112
2 libsystem_c.dylib 0x00000001a416a8a0 __abort + 112
3 libsystem_c.dylib 0x00000001a416a830 __abort + 0
4 libc++abi.dylib 0x00000001a42c37d4 __cxa_bad_cast + 0
5 libc++abi.dylib 0x00000001a42c39c4 demangling_unexpected_handler+ 6596 () + 0
6 libobjc.A.dylib 0x00000001a422b358 _objc_terminate+ 25432 () + 124
7 Livycs 0x0000000104113a94 CLSTerminateHandler() + 424596 (CLSException.mm:0)
8 libc++abi.dylib 0x00000001a42d0304 std::__terminate(void (*)+ 58116 ()) + 16
9 libc++abi.dylib 0x00000001a42cfed8 __cxa_rethrow + 144
10 libobjc.A.dylib 0x00000001a422b258 objc_exception_rethrow + 40
11 CoreFoundation 0x00000001a447a92c CFRunLoopRunSpecific + 576
12 GraphicsServices 0x00000001ae2e6328 GSEventRunModal + 104
13 UIKitCore 0x00000001a85106d4 UIApplicationMain + 1936
14 Livycs 0x00000001040d246c main + 156780 (SearchLocationViewController.swift:14)
15 libdyld.dylib 0x00000001a4305460 start + 4
The code where I think it crashes (WelcomeViewController.swift)
//
// WelcomeViewController.swift
// Livycs
//
// Created by Nir Sagiv on 03/03/2016.
// Copyright © 2016 Nir Sagiv. All rights reserved.
//
import UIKit
class WelcomeViewController: UIViewController {
#IBOutlet weak var showsRoundMeButton: UIButton!
#IBOutlet weak var showsByLocationBotton: UIButton!
#IBOutlet weak var iosVersion: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
showsRoundMeButton.layer.cornerRadius = 10
showsByLocationBotton.layer.cornerRadius = 10
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.backgroundColor = UIColor.clear
iosVersion.text = version()
BiAnalyticsService.logEvent("MainPage", withParameter: nil)
// Do any additional setup after loading the view.
}
override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func version() -> String {
let dictionary = Bundle.main.infoDictionary!
let version = dictionary["CFBundleShortVersionString"] as! String
let build = dictionary["CFBundleVersion"] as! String
return "v\(version) (\(build))"
}
#IBAction func searchShowsAroundMeButtonClicked(_ sender: UIButton) {
BiAnalyticsService.logEvent("MainPage:searchShowsAroundMeButtonClicked", withParameter: nil)
let vc:UITabBarController = (self.storyboard?.instantiateViewController(withIdentifier: "main")) as! UITabBarController
vc.selectedIndex = 0
self.present(vc, animated: true, completion: nil)
}
#IBAction func searchShowsByLocationButtonClicked(_ sender: UIButton) {
BiAnalyticsService.logEvent("MainPage:searchShowsByLocationButtonClicked", withParameter: nil)
let vc:UITabBarController = (self.storyboard?.instantiateViewController(withIdentifier: "main")) as! UITabBarController
vc.selectedIndex = 1
self.present(vc, animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
notice that I've cleared the BiAnalyticsService.logEvent... since I was thinking it might cause problems and the code there is now:
class func logEvent( eventName : String, withParameter : Dictionary<String,String>?){
// if withParameter == nil {
// mixpanel.track(eventName, properties: staticProperties)
// } else {
// var prm = withParameter!
//
// for key in staticProperties.keys {
// prm[key] = staticProperties[key]
// }
// mixpanel.track(eventName, properties: prm)
// }
}
Any help will be appreciated
Find in code "searchdisplay", it will appear somewhere in Storyboard at the bottom of one of your old viewcontrollers, remove this SearchDisplay item, and that's all.
In my case SearchDisplay was even linked to outlet (no real outlet actually existed! nore a single compiler error!), and obviously it was not used for a long time. Crash occured only in review team or via TestFlight, but not by cable, on any device. Review team's crashreports said nothing (symbolicate always failed), thus I killed three days nd three builds until got useful report from tester.
Use TestFlight now! Multiply debug on cable is not enough It's time :-(
Starting with iOS 13 and iPad OS 13, UISearchDisplayController is unavailable to apps built with Xcode 11.
UISearchDisplayController was deprecated starting with iOS 8, and you should use UISearchController
In order to reproduce this locally, you need to test the thinned variant of your app
If you receive one of these crashes but can't reproduce it locally,
ensure that you are testing the deployed version of your app on iOS
13, either by using TestFlight, or by applying app thinning to your
Xcode archive and testing the thinned variant of your app targeted at
iOS 13 devices. By testing with the thinned variant, you will be able
to reproduce this crash. To apply app thinning to your local Xcode
archive, export the app from the Xcode Archive using either the Ad-Hoc
or Development options, and select "All compatible device variants"
for the App Thinning option. After the thinned versions are created,
you can identify the specific variant targeted at iOS 13 by reading
the App Thinning Size Report file that is part of the output, and then
install and test that thinned .ipa file.
Please see: Apple Developer Forum
I have a Firebase integrated to my swift app. All the initialisation done is programmatically and the FirebaseApp.config() is called the very first thing in didLaunchWithOptions in the AppDelegate.
But for some random reason, whenever the app is in the background for a long time, the app just crashes on the run, i.e making it's state active.
Interestingly, this crash happens exactly 2 times in the following flow:
1. The App is idle in background
2. You bring it to the active mode(You just tap the icon to open the app. All this while the app isn't killed)
3. Tap 1 ---- The App Crashes----
4. Tap 2 ---- The App Crashes----
5. Tap 3 ---- The App Runs Normally ----
I tried to troubleshoot but all my efforts have gone in vain. I have tried setting up both the storyboards and programmatically launching app. Nothing works.
Following is the stack trace :
SpotMi-Dev[74741:2958059] *** Terminating app due to uncaught exception 'FIRAppNotConfigured', reason: 'Failed to get default Firebase Database instance. Must call `[FIRApp configure]` (`FirebaseApp.configure()` in Swift) before using Firebase Database.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d3816fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010c14aac5 objc_exception_throw + 48
2 CoreFoundation 0x000000010d381555 +[NSException raise:format:] + 197
3 SpotMi-Dev 0x0000000101be5ba1 +[FIRDatabase database] + 97
4 SpotMi-Dev 0x0000000101aaba6b $s10SpotMi_Dev13FBDataserviceCACycfc + 59
5 SpotMi-Dev 0x0000000101aac193 $s10SpotMi_Dev13FBDataserviceCACycfcTo + 19
6 SpotMi-Dev 0x0000000101aa696c $s10SpotMi_Dev13FBDataserviceCACycfC + 44
7 SpotMi-Dev 0x0000000101aa692c globalinit_33_8263DB418F9D5BC81149F56895386F46_func0 + 28
8 libdispatch.dylib 0x000000010ecaddb5 _dispatch_client_callout + 8
9 libdispatch.dylib 0x000000010ecaf83d _dispatch_once_callout + 66
10 libswiftCore.dylib 0x000000010e2c6579 swift_once + 25
11 SpotMi-Dev 0x0000000101aa69f4 $s10SpotMi_Dev13FBDataserviceC2dsACvau + 36
12 SpotMi-Dev 0x000000010180b013 $s10SpotMi_Dev9ProfileVCC18initializeUserPostyyF + 179
13 SpotMi-Dev 0x0000000101809278 $s10SpotMi_Dev9ProfileVCC11viewDidLoadyyF + 616
14 SpotMi-Dev 0x00000001018095b4 $s10SpotMi_Dev9ProfileVCC11viewDidLoadyyFTo + 36
15 UIKitCore 0x000000011589443b -[UIViewController loadViewIfRequired] + 1183
16 UIKitCore 0x0000000115894868 -[UIViewController view] + 27
17 UIKitCore 0x0000000115ebd4ad -[UIApplication(StateRestoration) _restoreApplicationPreservationStateWithSessionIdentifier:beginHandler:completionHandler:] + 6413
18 UIKitCore 0x0000000115eb8fdc -[UIApplication(StateRestoration) _doRestorationIfNecessary] + 211
19 UIKitCore 0x0000000115e8e2c9 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 208
20 UIKitCore 0x0000000115e8fcad -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3932
21 UIKitCore 0x0000000115e950c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
22 UIKitCore 0x00000001156da6d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
23 UIKitCore 0x00000001156e2fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
24 UIKitCore 0x00000001156da2ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
25 UIKitCore 0x00000001156dac48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
26 UIKitCore 0x00000001156d8fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
27 UIKitCore 0x00000001156d8c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
28 UIKitCore 0x00000001156dd9b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
29 UIKitCore 0x00000001156de610 _performActionsWithDelayForTransitionContext + 100
30 UIKitCore 0x00000001156dd71d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
31 UIKitCore 0x00000001156e26d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
32 UIKitCore 0x0000000115e939a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
33 UIKitCore 0x0000000115a4adfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
34 FrontBoardServices 0x00000001133a4125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
35 FrontBoardServices 0x00000001133aded6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
36 FrontBoardServices 0x00000001133ad700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
37 libdispatch.dylib 0x000000010ecaddb5 _dispatch_client_callout + 8
38 libdispatch.dylib 0x000000010ecb12ba _dispatch_block_invoke_direct + 300
39 FrontBoardServices 0x00000001133df146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
40 FrontBoardServices 0x00000001133dedfe -[FBSSerialQueue _performNext] + 451
41 FrontBoardServices 0x00000001133df393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
42 CoreFoundation 0x000000010d2e8be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
43 CoreFoundation 0x000000010d2e8463 __CFRunLoopDoSources0 + 243
44 CoreFoundation 0x000000010d2e2b1f __CFRunLoopRun + 1231
45 CoreFoundation 0x000000010d2e2302 CFRunLoopRunSpecific + 626
46 GraphicsServices 0x000000011034e2fe GSEventRunModal + 65
47 UIKitCore 0x0000000115e96ba2 UIApplicationMain + 140
48 SpotMi-Dev 0x000000010174287b main + 75
49 libdyld.dylib 0x000000010ed22541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Following is the code from didLaunchWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
#if DEVELOPMENT
print("Development Mode Started")
#else
print("Production Mode Started")
#endif
FirebaseApp.configure()
Messaging.messaging().delegate = self
//other app functions
return true
}
I am calling the Firebase API in the viewDidLoad of init controller. And this is the Service through which it gets called and this even contains the crash aswell.
class FBDataservice : NSObject {
static var ds = FBDataservice() //<------ Creates Error here on every single crash related to this issue
let DB_URL: DatabaseReference = Database.database().reference()
let ST_URL: StorageReference = Storage.storage().reference()
private lazy var _REF_BASE = DB_URL
}
And then I just call FBDataservice.ds._REF_BASE.child("something").observe( .Event, with (Datasnapshot)) in the viewDidLoad or viewDidAppear. I am just mostly fetching the data. And then push data like updating app RunCounts on didBecameActive in AppDelegate
Any help will immensely be appreciated. Cheers
Check FirebaseApp.app() if this is nil can you call the FirebaseApp.configure() again? You need to debug if this crashes in appDidBecomeActive: or didEneterInForeground: method.
Also please check where you use FirebaseDatabase at very first time after launching the application except the configuration line? I mean is in any ViewController or anywhere, we need to check the condition here.
Updated Question:
Regarding your updated question FBDataservice() where are you making its instance because as you create its instance it will create DB_URL and ST_URL url instances which are related to Firebase so probably Firebase is not configured before this. You can override its init method to check if Firebase is configured or not.
You took two variables which will be create in constructor whenever you will make an instance of this class.
Try one thing... replace
static var ds = FBDataservice()
with
static var ds: FBDataservice {
if FirebaseApp.app() == nil {
FirebaseApp.configure()
}
return FBDataservice()
}
Hello I have been seeing crash logs for my app which when I open in XCode highlights the following line
let appDelegate = UIApplication.shared.delegate as! AppDelegate
I am stumped as I cannot replicate this in XCode. What are the possible reasons the app may crash here?
This line is at viewDidAppear() and also at viewDidLoad() but 5 out of 5 crash reports all point to the line at viewDidAppear()
Edit:
Here's the crash log
Thread 0 name:
Thread 0 Crashed:
0 MyApp 0x0000000100531208 LoginViewController.initView() + 536 (LoginViewController.swift:107)
1 MyApp 0x0000000100530d88 #objc LoginViewController.viewDidAppear(_:) + 112 (LoginViewController.swift:58)
2 UIKit 0x000000018ee2973c -[UIViewController _setViewAppearState:isAnimating:] + 840 (UIViewController.m:4471)
3 UIKit 0x000000018f07a448 __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 44 (UIViewController.m:5055)
4 UIKit 0x000000018ee7f798 -[UIViewController _executeAfterAppearanceBlock] + 92 (UIViewController.m:4793)
5 UIKit 0x000000018f185990 _runAfterCACommitDeferredBlocks + 564 (UIApplication.m:2528)
6 UIKit 0x000000018f17b958 _cleanUpAfterCAFlushAndRunDeferredBlocks + 384 (UIApplication.m:2497)
7 UIKit 0x000000018f18c68c __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 152 (UIApplication.m:9928)
8 CoreFoundation 0x00000001851372bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20 (CFRunLoop.c:1840)
9 CoreFoundation 0x0000000185136a7c __CFRunLoopDoBlocks + 264 (CFRunLoop.c:1881)
10 CoreFoundation 0x00000001851347b0 __CFRunLoopRun + 1224 (CFRunLoop.c:2922)
11 CoreFoundation 0x0000000185054da8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
12 GraphicsServices 0x000000018703a020 GSEventRunModal + 100 (GSEvent.c:2245)
13 UIKit 0x000000018f074758 UIApplicationMain + 236 (UIApplication.m:3965)
14 MyApp 0x0000000100424f3c main + 56 (BaseViewController.swift:19)
15 libdyld.dylib 0x0000000184ae5fc0 start + 4
I found this delegate is optional value.
unowned(unsafe) open var delegate: UIApplicationDelegate?
So you should use it like this.
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
// code here
} else {
// error handle
}
I finally figured this out. The crash logs all point to this line
let appDelegate = UIApplication.shared.delegate as! AppDelegate
which is line 107 from my LoginViewController but the actual error is actually triggered by a line of code two lines prior (data related error). Don't know why the logs all point to line 107 though. Thanks for your help.
I have a crash occurring in life app which I can not reproduce on my devices. I have not been able to figure out what causes it. I studied to crash report but seem not to be able to understand what is causing this.
1 CoreFoundation __exceptionPreprocess + 1241536
2 libobjc.A.dylib objc_exception_throw + 34136
3 CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:] + 1270388
4 CoreFoundation ___forwarding___ + 1258100
5 CoreFoundation _CF_forwarding_prep_0 + 185752
6 GLKit -[GLKViewController setPaused:] + 144836
7 GLKit -[GLKViewController _pauseByNotification] + 142828
8 CoreFoundation __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 823848
9 CoreFoundation _CFXRegistrationPost + 821548
10 CoreFoundation ___CFXNotificationPost_block_invoke + 820904
11 CoreFoundation -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1276824
12 CoreFoundation _CFXNotificationPost + 44016
13 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 26152
14 UIKit -[UIApplication _deactivateForReason:notify:] + 491392
15 UIKit __61-[UIApplication _sceneSettingsPreLifecycleEventDiffInspector]_block_invoke + 2711892
16 FrontBoardServices __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke.27 + 144868
17 Foundation __NSIndexSetEnumerate + 788368
18 BaseBoard -[BSSettingsDiff inspectChangesWithBlock:] + 208636
19 FrontBoardServices -[FBSSettingsDiff inspectOtherChangesWithBlock:] + 120484
20 FrontBoardServices -[FBSSettingsDiffInspector inspectDiff:withContext:] + 144320
21 UIKit __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 2717116
22 UIKit -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 2716256
23 UIKit -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 6065056
24 FrontBoardServices __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.376 + 52104
25 FrontBoardServices __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 239800
26 FrontBoardServices -[FBSSerialQueue _performNext] + 239396
27 FrontBoardServices -[FBSSerialQueue _performNextFromRunLoopSource] + 240332
28 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 905844
29 CoreFoundation __CFRunLoopDoSources0 + 904124
30 CoreFoundation __CFRunLoopRun + 894908
31 CoreFoundation CFRunLoopRunSpecific + 36932
32 GraphicsServices GSEventRunModal + 49556
33 UIKit -[UIApplication _run] + 504568
34 UIKit UIApplicationMain + 483376
35 XXX main (XXXViewController.swift:14)
36 libdyld.dylib
start + 17844
Line 35 (only mention of code I wrote) is the XXXViewController class definition line:
class XXXViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
...
}
This ViewController calls an observer, which seems to be the problem. I am making sure the I remove all observers in the ViewControllers that use them in the deinit function.
deinit {
NSNotificationCenter.defaultCenter().removeObserver(self)
}
Does anybody have an idea what else could be going wrong?
UPDATE:
I register the observer like this ini init() (should I use viewDidLoad instead?):
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(YViewController.dataUpdate(_:)), name: "DataChanged", object: nil)
and post the notification like this:
NSNotificationCenter.defaultCenter().postNotificationName("DataChanged", object: self, userInfo: nil)
The YViewController dataUpdate is as follows:
func dataUpdate(notification: NSNotification) {
//Some stuff is done
}
I use swift 2.0 for now and the crash has happened on iOS version 10.0.1-10.1.1
Just in case anybody lands here. The problem was that I was overwriting the base view of the GLKViewController instead of adding the new view as a subview. This became easily clear, when I switched to Crashlytics, which had more information about the crash.