【发布时间】:2015-10-06 01:07:34
【问题描述】:
我使用 PhoneGap 将 AngularJS 应用程序转换为 Android 和 iOS。我需要升级到适用于 iOS 9 的最新版 PhoneGap,但它破坏了 Android 应用程序。
具体来说,它会阻止 ngResource 工作,因此我无法从我的服务器获取身份验证令牌。
在 config.xml 首选项设置为
的情况下,Android 可以正常工作<preference name="phonegap-version" value="3.7.0" />
Android 甚至无法通过其中任何一个向服务器发送请求
<preference name="phonegap-version" value="cli-5.1.1" />
<preference name="phonegap-version" value="cli-5.2.0" />
这是我的 AngularJs 登录函数和 ngResource 工厂。
$scope.login = function () {
AuthenticationService.get({
'clientId':$rootScope.clientId,
'clientSecret':$rootScope.clientSecret,
'username':$scope.loginData.username,
'password':$scope.loginData.password
},
function(data){},
function(error){
toastr.error('Authentication failed, please try again.');
}
)
.$promise.then(function(response){
...
});
};
.factory( 'AuthenticationService', function($resource, $rootScope) {
return $resource(
$rootScope.url+'/oauth/v2/token?client_id=:clientId&client_secret=:clientSecret&grant_type=password&username=:username&password=:password',
{
clientId:'@clientId',
clientSecret:'@clientSecret',
username:'@username',
password:'@password'
},
{
get: { method: 'JSONP', params: { callback: 'JSON_CALLBACK' }, isArray: false }
}
);
})
有谁知道可能导致此问题的 Android 版 PhoneGap 的新版本发生了什么变化?
【问题讨论】:
-
迈克,你的答案正在等待on nitobi
标签: android angularjs phonegap-build ngresource