我正在尝试调用WLAuthorizationManager.obtainAccessToken(),但它在我的Mac上调用错误函数但在我的电脑上运行正常。我在两者上使用的代码示例如下:
waitingForMFP (renderer: Renderer) {
this.tlpLogger.toLog('debug','-- Homepage waitingForMFP');
renderer.listenGlobal ('document', 'mfpjsloaded', () => {
this.tlpLogger.toLog('debug','-- Homepage waitingForMFP: The global event mfpjsloaded has been thrown');
WLAuthorizationManager.obtainAccessToken()
.then(
function(accessToken) {
this.tlpLogger.toLog('debug','-- Homepage waitingForMFP: Access token has been granted');
}.bind(this),
function(error) {
this.tlpLogger.toLog('warn','-- Homepage waitingForMFP: Access token failed: ' + JSON.stringify(error));
this.ngZone.run();
}.bind(this)
);
})
}
在这两种情况下,我都试图在Android设备上模仿这个。当我打印出"错误"对象,我得到以下内容:
{"status":-1,"responseText":"","errorMsg":"This version of the MobileFirst client SDK requires a minimal server version greater than IFIX 8.0.0.0-IF20161122-19","errorCode":"MINIMUM_SERVER"}
这条消息对我没有意义,因为它们都在Bluemix上同一台服务器,所以如果这是一个问题,我应该在两个环境中得到相同的消息。当我在两种环境中检查mfp cli的版本时,我得到了相同的答案:
$ mfpdev -v
8.0.0-2016121916
我试过调用" mfpdev app寄存器"两种环境都没有区别。
我在BOTH环境中的控制台日志(下面)中收到了另一个错误,但由于它是在obtainAccessToken()方法之后发生的,并且它发生在两个环境中,我认为它是无关的(尽管我试图解决另一个问题) )。消息是:
Uncaught TypeError: Cannot read property 'apply' of undefined
PC:
02-07 16:08:32.568 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(60929)] "-- Homepage waitingForMFP", source: file:///android_asset/www/build/main.js (60929)
02-07 16:08:32.645 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(2505)] "Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.", source: file:///android_asset/www/build/main.js (2505)
02-07 16:08:32.690 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(111840)] "DEVICE READY FIRED AFTER", source: file:///android_asset/www/build/main.js (111840)
02-07 16:08:32.698 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(3)] "Running static_app_props.js...", source: file:///android_asset/www/plugins/cordova-plugin-mfp/worklight/static_app_props.js (3)
02-07 16:08:32.884 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(60929)] "-- Homepage waitingForMFP: The global event mfpjsloaded has been thrown", source: file:///android_asset/www/build/main.js (60929)
02-07 16:08:32.887 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(73)] "Calling WL.Client.init(wlInitOptions);", source: file:///android_asset/www/plugins/cordova-plugin-mfp/bootstrap.js (73)
02-07 16:08:32.902 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(0)] "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.", source: (0)
02-07 16:08:33.521 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(60929)] "-- Homepage waitingForMFP: Access token has been granted", source: file:///android_asset/www/build/main.js (60929)
02-07 16:08:33.547 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(312)] "Error in Success callbackId: WLAuthorizationManagerPlugin756181927 : TypeError: Cannot read property 'apply' of undefined", source: file:///android_asset/www/cordova.js (312)
02-07 16:08:33.554 7485-7485/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(314)] "Uncaught TypeError: Cannot read property 'apply' of undefined", source: file:///android_asset/www/cordova.js (314)
的Mac:
02-07 16:07:12.240 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(60929)] "-- Homepage waitingForMFP", source: file:///android_asset/www/build/main.js (60929)
02-07 16:07:12.352 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(2505)] "Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.", source: file:///android_asset/www/build/main.js (2505)
02-07 16:07:12.418 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(111846)] "Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.", source: file:///android_asset/www/build/main.js (111846)
02-07 16:07:12.422 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(111841)] "DEVICE READY FIRED AFTER", source: file:///android_asset/www/build/main.js (111841)
02-07 16:07:12.433 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(3)] "Running static_app_props.js...", source: file:///android_asset/www/plugins/cordova-plugin-mfp/worklight/static_app_props.js (3)
02-07 16:07:12.779 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(60929)] "-- Homepage waitingForMFP: The global event mfpjsloaded has been thrown", source: file:///android_asset/www/build/main.js (60929)
02-07 16:07:12.790 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(73)] "Calling WL.Client.init(wlInitOptions);", source: file:///android_asset/www/plugins/cordova-plugin-mfp/bootstrap.js (73)
02-07 16:07:12.813 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(0)] "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.", source: (0)
02-07 16:07:13.294 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(60917)] "-- Homepage waitingForMFP: Access token failed: {"status":-1,"responseText":"","errorMsg":"This version of the MobileFirst client SDK requires a minimal server version greater than IFIX 8.0.0.0-IF20161122-19","errorCode":"MINIMUM_SERVER"}", source: file:///android_asset/www/build/main.js (60917)
02-07 16:07:13.315 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(312)] "Error in Error callbackId: WLAuthorizationManagerPlugin1973171517 : TypeError: Cannot read property 'apply' of undefined", source: file:///android_asset/www/cordova.js (312)
02-07 16:07:13.326 4122-4122/com.ionicframework.tlpapp360156 I/chromium: [INFO:CONSOLE(314)] "Uncaught TypeError: Cannot read property 'apply' of undefined", source: file:///android_asset/www/cordova.js (314)
非常感谢任何帮助!
答案 0 :(得分:2)
首先,检查CLI版本以检查兼容性并不重要...... CLI不会实例化服务器实例或将SDK添加到以前版本中的应用程序......所以它的版本不太重要
最近对Cordova插件进行了更新,引入了客户端 - 服务器不兼容错误。
我建议你要么: