以下のコードは、コードアンドロイドのsmsアクセス許可のプラグインコードです。それは正常に動作しています。私はそれは私が私が間違っているのか知ってはいけない 未知の型エラー:nullのプロパティ 'getSMS'を読み取ることができません
if the user tap allow then i am trying to call my
this.getSMS()
as you can see in the above code. if user deny then i am just getting error callback.
エラー
setTimeout(() => {
this.holders.dissmissLoadingCustom();
platform.ready().then(() => {
var permissions = cordova.plugins.permissions;
permissions.hasPermission(permissions.READ_SMS, checkPermissionCallback, null);
function checkPermissionCallback(status) {
if(!status.hasPermission) {
var errorCallback =() => {
console.log("invoking the errorCallback");
alert('READ_SMS permission is not turned on');
}
permissions.requestPermission(
permissions.READ_SMS,
(status) => {
console.log("invoking status");
if(!status.hasPermission) {
console.log("invoke !status.hasPermission");
errorCallback();
}
else{
console.log("invoking else part !status.hasPermission");
this.getSMS();//this line through error
}
},
errorCallback);
}
}
});
}, 10000);
をthroughingされ、私の
this.getSMS()
関数を呼び出すしようとしています
内部。
これはあなたを助けるかもしれません。 http://stackoverflow.com/questions/3127429/how-does-the-this-keyword-work – Prajwal
'checkPermissionCallback'を矢印関数にします –
@Prajwal私は以下のように答えようとしていますが、私はそれをスローすることはできませんあなたが何か考えがある場合は私に知らせてください。 –