2
votes

I am trying to create a simple parse log in that integrates both Twitter and Facebook as log in options in iOS9. Facebook login works fine but the Twitter login keeps crashing and no idea why? The crash leads to AppDelegate.swift saying there is a Sigabrt error "thread 1 signal sigabrt"

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    Parse.setApplicationId("<MY ID>", clientKey:"<MY CLIENT KEY>")
    PFTwitterUtils.initializeWithConsumerKey("<CONSUMER KEY>", consumerSecret:"<CONSUMER SECRET>")
    PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions);

NorthernLights[4119:358454] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' *** First throw call stack: ( 0 CoreFoundation 0x000000010d751e65 __exceptionPreprocess + 165 1 libobjc.A.dylib
0x000000010dadddeb objc_exception_throw + 48 2 CoreFoundation
0x000000010d6548ce -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318 3 CoreFoundation
0x000000010d666c3b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59 4 NorthernLights
0x000000010a77f349 -[PF_Twitter _showWebViewDialogAsync:requestSecret:] + 265 5 NorthernLights 0x000000010a78255a __38-[PF_Twitter _performWebViewAuthAsync]_block_invoke_2 + 346 6 libdispatch.dylib 0x000000010e59be5d _dispatch_call_block_and_release + 12 7
libdispatch.dylib 0x000000010e5bc49b _dispatch_client_callout + 8 8 libdispatch.dylib 0x000000010e5a42af _dispatch_main_queue_callback_4CF + 1738 9
CoreFoundation 0x000000010d6b1d09 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
+ 9 10 CoreFoundation 0x000000010d6732c9 __CFRunLoopRun + 2073 11 CoreFoundation 0x000000010d672828 CFRunLoopRunSpecific + 488 12 GraphicsServices
0x000000010f236ad2 GSEventRunModal + 161 13 UIKit
0x000000010bf52610 UIApplicationMain + 171 14 NorthernLights
0x000000010a5c90fd main + 109 15 libdyld.dylib
0x000000010e5f092d start + 1 16 ???
0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

1

1 Answers

0
votes

I was facing the same issue, when I implemented multiple url schemes in my app. The reason for the crash was Spotify was handling the twitter url schemes in application(_ app: UIApplication, open url: URL)

I was able to resolve the issue by checking the type of url scheme coming. For twitter I used

if url.scheme != nil && url.scheme!.hasPrefix("twitterkit"){ //Twitter SDK
        return TWTRTwitter.sharedInstance().application(app, open: url, options: options)
}  else{ //Other SDK's  }