使用CLI构建时,一切似乎都运行正常,直到我在控制台中查看预览,然后我看到有一些丢失的文件。这是控制台输出:
机器人:
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/.
GET http://localhost:10080/MyProject/apps/services/preview/MyApp/android/1.0/default/cordova/cordovasim.js 404 (Not Found)_mbs_cordova_sim_load_js @ cordova.js:21(anonymous function) @ cordova.js:53
worklight.js:5138 Uncaught Exception: Uncaught ReferenceError: cordova is not defined at (compiled_code):16156WL.Logger.__log @ worklight.js:5138WL.Logger.$.each.PUBLIC_API.(anonymous function) @ worklight.js:5520WL.Logger.window.onerror @ worklight.js:5478
worklight.js:16156 Uncaught ReferenceError: cordova is not defined(anonymous function) @ worklight.js:16156
worklight.js:5134 Initialization option 'connectOnStartup' is deprecated. Use WL.Client.connect() to connect to the IBM MobileFirst Platform Server.
worklight.js:5134 wlclient init started
dependencies.js:10 WL not defined ReferenceError: cordova is not defined
at klass.WL.BusyIndicator.WLJSX.Class.create.show (http://localhost:10080/MyProject/apps/services/preview/MyApp/android/1.0/default/worklight/worklight.js:12157:6)
at __showBusy (http://localhost:10080/MyProject/apps/services/preview/MyApp/android/1.0/default/worklight/worklight.js:7345:18)
at onEnvInit (http://localhost:10080/MyProject/apps/services/preview/MyApp/android/1.0/default/worklight/worklight.js:7660:14)
at init (http://localhost:10080/MyProject/apps/services/preview/MyApp/android/1.0/default/worklight/worklight.js:8128:4)
at http://localhost:10080/MyProject/apps/services/preview/MyApp/android/1.0/default/assets/js/dependencies.js:10:990(anonymous function) @ dependencies.js:10
angular-libs.js:8 [10:40:49]MyApp.home.controller :: [INFO] Welcome to MyApp
iPhone:
http://localhost:10080/MyProject/apps/services/preview/MyApp/iphone/1.0/default/worklight/cordova.js Failed to load resource: the server responded with a status of 404 (Not Found)_mbs_cordova_sim_load_js @ cordova.js:21
cordova.js:26 Uncaught ReferenceError: cordova is not defined
worklight.js:5134 Initialization option 'connectOnStartup' is deprecated. Use WL.Client.connect() to connect to the IBM MobileFirst Platform Server.
worklight.js:5134 wlclient init started
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/init]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
http://localhost:10080/MyProject/apps/services/api/MyApp/iphone/init Failed to load resource: the server responded with a status of 401 (Unauthorized)
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/init]
angular-libs.js:8 [10:38:54]MyApp.home.controller :: [INFO] Welcome to MyApp
http://localhost:10080/favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/init] success: /*-secure-
{"userPrefs":{},"WL-Authentication-Success":{"wl_directUpdateRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null","deviceId":"null"},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null","deviceId":"null"},"wl_antiXSRFRealm":{"userId":"1n4ulchkhlmjgom2cmafk8qvpm","attributes":{},"isUserAuthenticated":1,"displayName":"1n4ulchkhlmjgom2cmafk8qvpm","deviceId":"1n4ulchkhlmjgom2cmafk8qvpm"},"wl_deviceNoProvisioningRealm":{"userId":"previewDummyId","attributes":{"mobileClientData":"com.worklight.core.auth.ext.MobileClientData@ff55f"},"isUserAuthenticated":1,"displayName":"previewDummyId","deviceId":"previewDummyId"},"wl_anonymousUserRealm":{"userId":"6ba49e22-f899-4b14-ae72-fc4fde9100de","attributes":{},"isUserAuthenticated":1,"displayName":"6ba49e22-f899-4b14-ae72-fc4fde9100de","deviceId":"6ba49e22-f899-4b14-ae72-fc4fde9100de"}},"gadgetProps":{"ENVIRONMENT":"iphone"},"userInfo":{"SubscribeServlet":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null,"deviceId":null},"wl_directUpdateRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null","deviceId":"null"},"wl_authenticityRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null,"deviceId":null},"SampleAppRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null,"deviceId":null},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null","deviceId":"null"},"wl_antiXSRFRealm":{"userId":"1n4ulchkhlmjgom2cmafk8qvpm","attributes":{},"isUserAuthenticated":1,"displayName":"1n4ulchkhlmjgom2cmafk8qvpm","deviceId":"1n4ulchkhlmjgom2cmafk8qvpm"},"wl_deviceAutoProvisioningRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null,"deviceId":null},"wl_deviceNoProvisioningRealm":{"userId":"previewDummyId","attributes":{"mobileClientData":"com.worklight.core.auth.ext.MobileClientData@ff55f"},"isUserAuthenticated":1,"displayName":"previewDummyId","deviceId":"previewDummyId"},"myserver":{"userId":"6ba49e22-f899-4b14-ae72-fc4fde9100de","attributes":{},"isUserAuthenticated":1,"displayName":"6ba49e22-f899-4b14-ae72-fc4fde9100de","deviceId":"6ba49e22-f899-4b14-ae72-fc4fde9100de"},"wl_anonymousUserRealm":{"userId":"6ba49e22-f899-4b14-ae72-fc4fde9100de","attributes":{},"isUserAuthenticated":1,"displayName":"6ba49e22-f899-4b14-ae72-fc4fde9100de","deviceId":"6ba49e22-f899-4b14-ae72-fc4fde9100de"}}}*/
worklight.js:5788 No matching configurations found from the server. Defaulting to local configuration
worklight.js:5134 wlclient connect success
worklight.js:5134 before: initOptions.onSuccess
worklight.js:5134 after: initOptions.onSuccess
worklight.js:5134 wlclient init success
worklight.js:5134 Request [/MyProject/apps/services/loguploader]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 Request [/MyProject/apps/services/loguploader]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/loguploader] success:
worklight.js:5701 Client logs successfully sent to the server
worklight.js:5134 response [/MyProject/apps/services/loguploader] success:
worklight.js:5701 Client logs successfully sent to the server
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
worklight.js:5134 Request [/MyProject/apps/services/api/MyApp/iphone/heartbeat]
worklight.js:5134 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":"1161280635"}}WL.Logger.__log @ worklight.js:5134PUBLIC_API.(anonymous function) @ worklight.js:5520window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeaders @ worklight.js:3337window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequest @ worklight.js:3395window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initialize @ worklight.js:3309klass @ worklight.js:527sendHeartBeat @ worklight.js:7276onTimerEvent @ worklight.js:896(anonymous function) @ worklight.js:959
worklight.js:5134 response [/MyProject/apps/services/api/MyApp/iphone/heartbeat] success:
worklight.js:5134 Heartbeat sent successfully
worklight.js:5134 Piggybacking event transmission
worklight.js:5134 Flush called
我注意到在使用Eclipse构建项目时编写的文件与从cli构建项目时的日期编号差异...是否有一种简单的方法可以检查并获取CLI的更新?
(为了清楚起见,我们在Eclipse中使用Studio时没有看到这个问题。)
答案 0 :(得分:1)
这是完全可以预期的。
从预览网址看,您似乎正在查看实际上只加载网络资源的“简单预览” - 在这种情况下,Cordova确实无法使用,因为Cordova仅在预览实际应用时可用< / em>在移动浏览器模拟器或特定环境的IDE(Xcode,Android模拟器等)中。
如果您将在移动浏览器模拟器中启动您的应用程序 - 此工具通过模仿它来提供一些Cordova功能。
如果您要使用MBS预览网址,例如以下内容 - 您将看不到任何错误:http://10.0.0.3:10080/_MobileBrowserSimulator/index.html?webpage=/test/apps/services/preview/test/iphone/1.0/&platform=ios.iphone
但是,如果您将“删除”MBS并预览以下内容 - 您会看到相同的错误:http://10.0.0.3:10080/test/apps/services/preview/test/iphone/1.0/default/index.html
http://10.0.0.3:10080/test/apps/services/preview/test/iphone/1.0/default/worklight/cordova.js 无法加载资源:服务器响应状态为404 (未找到)_mbs_cordova_sim_load_js @ cordova.js:19
2015-06-25 20:01:08.608 cordova.js:24 Uncaught ReferenceError:cordova 未定义
答案 1 :(得分:0)
正如Idan解释的那样,这是预期的。
我正在使用mfp preview --noshell
开始预览。如果我放弃--noshell
,它会使用MobileBrowserSimulator链接,但我不会收到这些错误。