Closed harryraturi closed 5 years ago
I found the root cause, the problem is not as I post here, the problem is like this (https://stackoverflow.com/questions/39888601/private-func-didfinishlaunchingwithoptions-not-being-called-swift-3), so in app-delegate class application - didFinishLaunchingWithOptions is not called.
While fetching sessionStore from Twitter SDK, it's getting crash! See the attached image[![
TWTRTwitter.sharedInstance().sessionStore
or
if let twitterSession = TWTRTwitter.sharedInstance().sessionStore.session() { // Logout the user here... }
Getting below error:
TWTRTwitter.sharedInstance().sessionStore
2019-04-13 08:49:25.271738+0530 YourProjectName[5613:53431] Terminating app due to uncaught exception 'TWTRInvalidInitializationException', reason: 'Attempted to call TwitterKit methods before calling the requisite start method. You must call TWTRTwitter.sharedInstance().start(withConsumerKey:consumerSecret:) before calling any other methods.' First throw call stack: ( 0 CoreFoundation 0x00000001066836fb exceptionPreprocess + 331 1 libobjc.A.dylib 0x0000000105ab2ac5 objc_exception_throw + 48 2 CoreFoundation 0x0000000106683555 +[NSException raise:format:] + 197 3 TwitterKit 0x0000000104fdc9fb -[TWTRTwitter sessionStore] + 22 4 YourProjectName 0x0000000101180054 $s10YourProjectName19MyProfileControllerC18logoutButtonTappedyyypF + 180 5 YourProjectName 0x000000010118040c $s10YourProjectName19MyProfileControllerC18logoutButtonTappedyyypFTo + 76 6 UIKitCore 0x000000011101f204 -[UIApplication sendAction:to:from:forEvent:] + 83 7 UIKitCore 0x0000000110a74c19 -[UIControl sendAction:to:forEvent:] + 67 8 UIKitCore 0x0000000110a74f36 -[UIControl _sendActionsForEvents:withEvent:] + 450 9 UIKitCore 0x0000000110a73eec -[UIControl touchesEnded:withEvent:] + 583 10 UIKitCore 0x0000000110c009c9 _UIGestureEnvironmentUpdate + 10367 11 UIKitCore 0x0000000110bfe108 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 478 12 UIKitCore 0x0000000110bfde96 -[UIGestureEnvironment _updateForEvent:window:] + 200 13 UIKitCore 0x00000001110595bc -[UIWindow sendEvent:] + 4057 14 UIKitCore 0x0000000111037d16 -[UIApplication sendEvent:] + 356 15 UIKitCore 0x0000000111108293 dispatchPreprocessedEventFromEventQueue + 3232 16 UIKitCore 0x000000011110abb9 handleEventQueueInternal + 5911 17 CoreFoundation 0x00000001065eabe1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 18 CoreFoundation 0x00000001065ea463 CFRunLoopDoSources0 + 243 19 CoreFoundation 0x00000001065e4b1f __CFRunLoopRun + 1231 20 CoreFoundation 0x00000001065e4302 CFRunLoopRunSpecific + 626 21 GraphicsServices 0x000000010b0752fe GSEventRunModal + 65 22 UIKitCore 0x000000011101dba2 UIApplicationMain + 140 23 YourProjectName 0x000000010138d39b main + 75 24 libdyld.dylib 0x0000000108bcb541 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)