unable to load main object from bundle.js using cordova
I am aware there is duplicate question, but answer did not work for me.
I have a web app which is working fine on desktop. I would like to use cordova to wrap it in a mobile version.
I can't load the browserified bundle and can't make calls with jquery token input.
In my index.html:
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery.tokeninput.js"></script>
<script type="text/javascript" src="js/bundle.js"></script>
The main app object, let's say myApp, is in bundle.js.
In my index.html there is an additional script, to bind a search function with jquery tokeninput, which will launch myApp.main( keyword )
.
In index.html
, I will bind the functions with a script at the end of <body>
:
$(document).ready(function() { alert('test script loaded from index.html') // does not fire) }
In my index.js
of cordova, I am trying a basic test:
onDeviceReady: function() { this.receivedEvent('deviceready');
alert('test from cordova index.js'); // ok
if ($) alert('$ loaded') // ok
if ($.tokenInput) alert ('$.tokenInput') // ok
try {
window.myApp = myApp
} catch(err) {
console.log('no app?', err);
alert(err); // cannot find variable myApp
}
},
It looks there are two errors here: I can't execute jquery(document).ready() on index.html, and the bundle.js seems not loaded either.
Which is a simplest way to wrap the browserified wep app in cordova?
Below, if of help, a console log for ios simulator; cordova for iOS@4.0.0
and compiler xcode 6.2
Oct 1 19:17:41 my-computer.local CoreSimulatorBridge[97582]: LaunchServices: installing app for existing placeholder <LSApplicationProxy: 0x7fb864a17ce0> com.example.hello
Oct 1 19:17:41 my-computer.local CoreSimulatorBridge[97582]: LaunchServices: Not creating progress for <LSApplicationProxy: 0x7fb864a17ce0> com.example.hello since it is not a placeholder.
Oct 1 19:17:41 my-computer.local installd[97570]: 0x10e924000 -[MIClientConnection _doBackgroundInstallationForPath:withOptions:completion:]: Install of "/Users/gg4u/Sites/learndiscovery_light/hello/platforms/ios/build/emulator/HelloWorld.app" type Developer requested by CoreSimulatorBridge (pid 97582)
Oct 1 19:17:41 my-computer.local installd[97570]: 0x10e924000 MDMCreateDeltaDirectory: calling MDMDirectoryDiff with:
state->old_bundle: /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Containers/Bundle/Application/6C12C45A-35B5-40BF-B9C9-24A3798FF47B/HelloWorld.app
state->new_bundle: /Users/gg4u/Sites/learndiscovery_light/hello/platforms/ios/build/emulator/HelloWorld.app
state->dst_bundle: /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Library/Caches/com.apple.mobile.installd.staging/temp.DNjSbw/extracted/Payload//HelloWorld.app, binaryDiff flag: FALSE
dst_ipa: /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Library/Caches/com.apple.mobile.installd.staging/temp.DNjSbw/extracted
Oct 1 19:17:41 my-computer.local installd[97570]: 0x10e924000 createDictFromFile: open failed for /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Containers/Bundle/Application/6C12C45A-35B5-40BF-B9C9-24A3798FF47B/ManifestCache.plist : No such file or directory
Oct 1 19:17:41 my-computer.local installd[97570]: 0x10e595000 __MDMDirectoryDiff_block_invoke29: calling writeDictToFile with: /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Library/Caches/com.apple.mobile.installd.staging/temp.DNjSbw/extracted/ManifestCache.plist
Oct 1 19:17:41 my-computer.local installd[97570]: 0x10e595000 writeDictToFile: ==== Successfully wrote Manifest cache to /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Library/Caches/com.apple.mobile.installd.staging/temp.DNjSbw/extracted/ManifestCache.plist
Oct 1 19:17:42 my-computer.local installd[97570]: 0x10e924000 -[MIInstaller performInstallationWithError:]: Installing <MIInstallableBundlePatch ID=com.example.hello; Version=1.0.0, ShortVersion=1.0.0>
Oct 1 19:17:42 my-computer.local installd[97570]: 0x10e924000 -[MIInstallableBundlePatch applyPatchWithError:]: Attempting patch update of com.example.hello from 1.0.0 (1.0.0) to 1.0.0 (1.0.0)
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: Killing com.example.hello for termination assertion
Oct 1 19:17:42 my-computer.local pkd[97591]: releasing plug-in hold 1C539A6F-9B76-4EB2-BFEC-C78D1FBC2756 for dead client pid 97574
Oct 1 19:17:42 gg4u-2 com.apple.CoreSimulator.SimDevice.967377E0-2418-4069-8B52-8447DC3C273F.launchd_sim[97561] (UIKitApplication:com.example.hello[0xea3f][1729]): Service exited due to signal: Killed: 9
Oct 1 19:17:42 my-computer.local installd[97570]: 0x10e924000 -[MIInstallableBundle _refreshUUIDForContainer:withError:]: Data container for com.example.hello is now at /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Containers/Data/Application/D5CC347D-D8B8-43FF-BFF6-453C3F747481
Oct 1 19:17:42 my-computer.local installd[97570]: 0x10e924000 -[MIContainer makeContainerLiveReplacingContainer:withError:]: Made container live for com.example.hello at /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Containers/Bundle/Application/8F096F99-3B40-4124-B406-70C907FEA3CE
Oct 1 19:17:42 my-computer.local installd[97570]: 0x10e924000 -[MIInstaller performInstallationWithError:]: Staging: 0.06s; Waiting: 0.00s; Installation: 0.05s; Overall: 0.11s
Oct 1 19:17:42 my-computer.local CoreSimulatorBridge[97582]: LaunchServices: NotifiedObservers <LSApplicationProxy: 0x7fb863f0df70> com.example.hello was installed
Oct 1 19:17:42 my-computer.local lsd[97589]: LaunchServices: Updating identifier store
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: [com.example.hello (1729)] Kill failed. Error: No such process (3)
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: libMobileGestalt MobileGestalt.c:841: still-camera is static and will never generate a notification
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: libMobileGestalt MobileGestalt.c:841: stand-alone-contacts is static and will never generate a notification
Oct 1 19:17:42 my-computer.local /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/libexec/lsd[97589]: LaunchServices: Failed to set the data protection class for /Users/gg4u/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/tmp/com.apple.IconsCache/com.example.hello_CFBundleIcon[15]
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: Installed apps did change.
Added: {(
)}
Removed: {(
)}
Modified: {(
"com.example.hello"
)}
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.MobileSMS
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: throwing out icon because its isn't visible in the model : node=<SBApplicationIcon: 0x7f9fc8b25e70; nodeID: "com.apple.camera"> com.apple.camera
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.weather
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.mobiletimer
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.videos
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.mobilenotes
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.reminders
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.stocks
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.iBooks
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.MobileStore
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.AppStore
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.Bridge
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.facetime
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.calculator
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.podcasts
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.compass
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.tips
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.VoiceMemos
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.mobilephone
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.mobilemail
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: could not find icon for representation -> com.apple.Music
Oct 1 19:17:42 my-computer.local SpringBoard[97574]: Application 'UIKitApplication:com.example.hello[0xea3f]' exited abnormally via signal.
Oct 1 19:17:42 gg4u-2 assertiond[97578]: assertion failed: 13F34 12D508: assertiond + 12446 [6756D728-8EE6-3DA2-B069-3EA61C107DF8]: 0x1
Oct 1 19:17:43 --- last message repeated 2 times ---
Oct 1 19:17:43 gg4u-2 HelloWorld[1847]: assertion failed: 13F34 12D508: libxpc.dylib + 68972 [701C1196-AADE-335F-B7E6-B42F53982A50]: 0x7d
Oct 1 19:17:43 my-computer.local HelloWorld[1847]: DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/my-computer/Library/Developer/CoreSimulator/Devices/967377E0-2418-4069-8B52-8447DC3C273F/data/Containers/Data/Application/D5CC347D-D8B8-43FF-BFF6-453C3F747481/Library/Cookies/Cookies.binarycookies
Oct 1 19:17:43 gg4u-2 assertiond[97578]: assertion failed: 13F34 12D508: assertiond + 12446 [6756D728-8EE6-3DA2-B069-3EA61C107DF8]: 0x1
Oct 1 19:17:43 my-computer.local SpringBoard[97574]: [MPUSystemMediaControls] Updating supported commands for now playing application.
Oct 1 19:17:43 my-computer.local HelloWorld[1847]: Apache Cordova native platform version 4.0.0 is starting.
Oct 1 19:17:43 my-computer.local HelloWorld[1847]: Multi-tasking -> Device: YES, App: YES
Oct 1 19:17:43 my-computer.local webinspectord[97602]: Unable to get entitlements for client task to verify entitlement com.apple.private.webinspector.allow-remote-inspection. Error: Error Domain=NSPOSIXErrorDomain Code=-1 "The operation couldn’t be completed. (POSIX error -1 - Unknown error: -1)"
链接地址: http://www.djcxy.com/p/61942.html
上一篇: 在MongoDB中单独查询;