我按照https://ionicframework.com/docs/native/google-plus/中的说明操作.
我使用正确的SHA-1 在https://console.cloud.google.com/apis/credentials/oauthclient中创建了Android客户端(重新检查使用keytool -list -printcert -jarfile <path to your apk>)
登录代码很简单,如说明:
this.googlePlus.login({})
.then(res => console.log(res))
.catch(err => console.error(err));
Run Code Online (Sandbox Code Playgroud)
然而,它从未进入既不then也不是catch.控制台中不显示错误.
离子版3.20.0
Cordova版本7.1.0
Ionic Native GooglePlus 5.3.0
Android手机版5.1.1
cordova-plugin-googleplus 5.3.0
我花了两天时间,Ionic Native Facebook工作正常,而GooglePlus只是默默地失败了.
请指教.
更新1
这似乎是一个问题cordova-plugin-googleplus,就像我正在改变GooglePlus.execute使用时一样
@Override
public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
this.savedCallbackContext = callbackContext;
savedCallbackContext.error(42);
action = "abracadabra";
... //remains unchanged
Run Code Online (Sandbox Code Playgroud)
然后我在Chrome控制台42中看到 - 这意味着,错误处理在cordova-plugin-googleplus插件中无法正常工作.
cordova ionic-framework google-plus-signin ionic-native ionic3