appInviteDialog中的EXC_BREAKPOINT didCompleteWithResults委托方法| Facebook应用程序邀请

时间:2015-09-03 09:40:31

标签: ios facebook swift facebook-ios-sdk crashlytics

我从crashlytics获得以下崩溃报告。在iOS上接收Facebook sdk appInviteDialog的委托方法时,我的应用程序崩溃了。问题是ImplicitlyUnwrappedOptional所以看起来facebook正在委托方法上发送nil。但我不确定。 有没有人知道它是FB SDK上的错误还是我做错了什么?

Thread : Crashed: com.apple.main-thread
0  MY_APP                     0x00000001000a7c28 function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of MY_APP.GameScene.appInviteDialog (MY_APP.GameScene)(Swift.ImplicitlyUnwrappedOptional<ObjectiveC.FBSDKAppInviteDialog>, didCompleteWithResults : Swift.ImplicitlyUnwrappedOptional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>) -> () (GameScene.swift:1569)
1  MY_APP                     0x00000001000884c4 @objc MY_APP.GameScene.appInviteDialog (MY_APP.GameScene)(Swift.ImplicitlyUnwrappedOptional<ObjectiveC.FBSDKAppInviteDialog>, didCompleteWithResults : Swift.ImplicitlyUnwrappedOptional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>) -> () (GameScene.swift)
2  MY_APP                     0x00000001005588a4 -[FBSDKAppInviteDialog _invokeDelegateDidCompleteWithResults:] (FBSDKAppInviteDialog.m:143)
3  MY_APP                     0x0000000100558744 -[FBSDKAppInviteDialog _handleCompletionWithDialogResults:error:] (FBSDKAppInviteDialog.m:124)
4  MY_APP                     0x0000000100558510 __28-[FBSDKAppInviteDialog show]_block_invoke (FBSDKAppInviteDialog.m:83)
5  MY_APP                     0x00000001005585f0 __28-[FBSDKAppInviteDialog show]_block_invoke64 (FBSDKAppInviteDialog.m:98)
6  MY_APP                     0x000000010038b4c4 -[FBSDKApplicationDelegate applicationDidBecomeActive:] (FBSDKApplicationDelegate.m:178)
7  CoreFoundation                 0x00000001862ee010 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
8  CoreFoundation                 0x000000018622b0f0 _CFXNotificationPost + 2060
9  Foundation                     0x000000018715aa80 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
10 UIKit                          0x000000018ae47298 -[UIApplication _stopDeactivatingForReason:] + 516
11 UIKit                          0x000000018b059458 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:] + 2716
12 UIKit                          0x000000018b04f9f0 -[UIApplication workspace:didReceiveActions:] + 128
13 FrontBoardServices             0x000000018eb893c8 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 32
14 CoreFoundation                 0x00000001862fffc8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
15 CoreFoundation                 0x00000001862ff0d0 __CFRunLoopDoBlocks + 312
16 CoreFoundation                 0x00000001862fd6f4 __CFRunLoopRun + 1756
17 CoreFoundation                 0x0000000186228f74 CFRunLoopRunSpecific + 396
18 GraphicsServices               0x000000018fc8b6fc GSEventRunModal + 168
19 UIKit                          0x000000018ae2ad94 UIApplicationMain + 1488
20 MY_APP                     0x00000001000c2c58 main (AppDelegate.swift:16)
21 libdyld.dylib                  0x000000019866ea08 start + 4

这是我在GameScene文件中的代码。请注意,这是一种委托方法:

func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
    if(results.count == 1){
        println("facebook invite successful \(results)")
        if(self.isSaveMeButtonPressed){
            Flurry.logEvent("FBInvite")
            var build = GAIDictionaryBuilder.createEventWithCategory("Growth", action: "Facebook", label: "FBInvite", value: nil).build() as [NSObject : AnyObject]
            googleTracker.send(build)
        }
    }
}

崩溃报告中显示的行号是函数的结束括号(函数的最后一行)。请注意,应用程序并不总是崩溃,事实上我至今还没有能够重现崩溃。

2 个答案:

答案 0 :(得分:1)

实施这两个代表。

(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog    didCompleteWithResults:(NSDictionary *)results { 
   NSLog(@"app invite result: %@", results);
}

(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error { 
    NSLog(@"app invite error: %@", error.localizedDescription); 
}

答案 1 :(得分:0)

我也遇到过这种错误。 [ViewController appInviteDialog:didCompleteWithResults:]:无法识别的选择器发送到实例

我实现了FBSDKAppInviteDialog

的委托方法
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results{
         NSLog(@"app invite result: %@", results);
         BOOL complete = [[results valueForKeyPath:@"didComplete"] boolValue];
         if (complete) {

         }
 }


- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error{
       NSLog(@"app invite error: %@", error.localizedDescription);
  }