【问题标题】:How to send invitation to Facebook friends on iOS using Cordova?如何使用 Cordova 向 iOS 上的 Facebook 好友发送邀请?
【发布时间】:2019-12-12 14:52:47
【问题描述】:

使用完全相同的代码库,我可以在 Android 上完美运行 Facebook 事件。但是,在 iOS 上它不起作用。我为此使用https://github.com/jeduan/cordova-plugin-facebook4,并尝试设置一些警报以查看错误代码或其他内容(请注意代码中的alert,用于调试目的),但没有任何操作。本质上,我看不到任何错误,它只是不起作用。以下代码:

this.options = {
    method: 'apprequests',
    message: 'Play YellowSidd with me!'
};
this.onSuccess = function(result) {
   alert("Success with invite, result: " + result);
};
this.onError = function(msg) {
   alert("Failed with invite, msg: " + msg);
};

facebookConnectPlugin.showDialog(this.options, this.onSuccess, this.onError);

在 Xcode 的 Build Phases -> Compile Sources 我确实有 FacebookConnectPlugin.m。在 Build Phases -> Link Binary with Libraries 我还有以下内容:libsqlite3.dylib(由我添加)、Security.framework(由我添加)、Accounts.framework(由我添加),Social.framework(由我添加)。此外,FBSDKCoreKit.frameworkFBSDKLoginKit.frameworkFBSDKShareKit.framework。最后 3 个已经在那个项目中了。

【问题讨论】:

  • @DarShan:cordova 适用于 android 和 ios,由于它适用于 android 而不是 ios,我会说 android 标签没问题 - 这是问题的一部分。

标签: javascript android ios facebook cordova


【解决方案1】:

显然,在 iOS 平台上使用此插件时需要 actionType,即使在 Android 上,没有它一切正常。最终得到以下在 iOS 上运行良好的代码:

this.options = {
  actionType: '',
  method: 'apprequests',
  message: 'Play YellowSidd with me!'
};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-27
    • 2017-08-06
    • 2015-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多