简体   繁体   English

FBSDKGraphRequest 实例方法 '-startWithCompletionHandler:' 未找到(返回类型默认为 'id')

[英]FBSDKGraphRequest Instance method '-startWithCompletionHandler:' not found (return type defaults to 'id')

I'm not ObjectiveC savvy or iOS savvy but I'm trying to muddle through this new issue with this code.我不是 ObjectiveC 精通或 iOS 精通,但我试图用这段代码来解决这个新问题。 I updated the Facebook SDK pod to v12.0.0 and now I'm getting this warning:我将 Facebook SDK pod 更新为 v12.0.0,现在我收到以下警告:

Instance method '-startWithCompletionHandler:' not found (return type defaults to 'id') on the last line of the following code block.在以下代码块的最后一行找不到实例方法“-startWithCompletionHandler:”(返回类型默认为“id”)。

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:_graphPath
                                                               parameters:arrayParams
                                                               HTTPMethod:_httpMethod];

[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error)
{

Project will build and run, but when this code is called the graph request is made and then it throws an exception:项目将构建并运行,但是当调用此代码时,会发出图形请求,然后引发异常:

terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKGraphRequest startWithCompletionHandler:]: unrecognized selector sent to instance 0x28241b000'以 NSException 类型的未捕获异常终止 *** 由于未捕获异常“NSInvalidArgumentException”而终止应用程序,原因:“-[FBSDKGraphRequest startWithCompletionHandler:]:无法识别的选择器发送到实例 0x28241b000”

Official Facebook Docs say to implement like this:官方 Facebook 文档说要这样实现:

   [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
  if (!error) {
     NSLog(@"fetched user:%@", result);
  }

}]; }];

The xcode warning is still there for startWithCompletionHandler not being found and the exception still gets thrown using this code block. xcode 警告仍然存在,因为找不到 startWithCompletionHandler 并且使用此代码块仍然会引发异常。

Any direction would be greatly appreciated as I've Googled myself into a stupor!任何方向都将不胜感激,因为我已经用谷歌搜索自己进入昏迷状态!

Ok finally hit the right Google combination and found: https://github.com/facebook/facebook-ios-sdk/blob/main/FBSDKTVOSKit/FBSDKTVOSKit/FBSDKDeviceLoginViewController.m Ok终于打对了Google组合,发现: https://github.com/facebook/facebook-ios-sdk/blob/main/FBSDKTVOSKit/FBSDKTVOSKit/FBSDKDeviceLoginViewController.m

Here it gives an example of the new startWithCompletion instead of startWithCompletionHandler.这里给出了一个新的 startWithCompletion 而不是 startWithCompletionHandler 的例子。

    FBSDKGraphRequest *graphRequest = [[FBSDKGraphRequest alloc] initWithGraphPath:_graphPath
       parameters:arrayParams
       HTTPMethod:_httpMethod];

  [graphRequest startWithCompletion:^(id<FBSDKGraphRequestConnecting> connection, id result, NSError *error) {

Thanks @Larme for highlighting the right direction!感谢@Larme 强调正确的方向!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到实例方法(返回类型默认为id) - Instance method not found (return type defaults to id) 未找到实例方法(返回类型默认为&#39;id&#39;) - Instance method not found (return type defaults to 'id') 找不到实例方法xyz(返回类型默认为id)? - Instance method xyz not found (return type defaults to id)? 找不到实例方法“ -_setWebGLEnabled:”(返回类型默认为“ id”) - Instance method '-_setWebGLEnabled:' not found (return type defaults to 'id') 找不到用于实例的实例方法(返回类型默认为“ id”) - Instance method not found (return type defaults to 'id') for init Beautify - 实例方法&#39;-initWithColor:width:radius:&#39;not found(返回类型默认为&#39;id&#39;) - Beautify - Instance method '-initWithColor:width:radius:' not found (return type defaults to 'id') 如何解决问题:“找不到&#39;实例方法&#39;-arrayByPerformingSelector:&#39;(返回类型默认为&#39;id&#39;)” - how to resolve the issue: “'Instance method '-arrayByPerformingSelector:' not found (return type defaults to 'id')” 找不到类方法“ + configureWithApplicationID:”(返回类型默认为“ id”) - class method '+configureWithApplicationID:' not found (return type defaults to 'id') FBRequest requestForMe startWithCompletionHandler方法在设备上不起作用 - FBRequest requestForMe startWithCompletionHandler method not working on device 在运行时获取实例方法的返回值类型 - getting return value type of an instance method in runtime
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM