当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - phonegap.js (cordova.js) functionality missing, or invalid

问题描述:

Ok, trying to build out my first phonegap based project and I am coming to a point where I need to start tieing into the device such as the camera. Which I can't do due to errors like:

Can't find variable: FileUploadOptions

Which I have found means that I have to have this js file called phonegap.js. Which from what I have learned generates at the time of building out your app. However. Sometime in the recent past support for phonegap.js has been removed, and cordova.js is now apparently the file that replaces it. Which this did generate. However the function above for example, fails because there is no reference to such a function/class anywhere in cordova.js yet the cordova docs/help point to phonegap docs.. which tell you to include this plugin (which I do) and tells me how to do things which I follow to a letter so I can first try to get it working. So, this continues to fail.

I go out and find a copy of a phonegap.js but its useless to me as its an older version concept. 1.9.0 (and who knows which platform it was generated for) Either way for giggles I try with that one I get a syntax error. Soooo..

Can someone for the sake of my sanity tell me, one, why is it so hard for the docs to describe these things. two.. If the file is supposed to generate, but doesn't yet its required, what does one do?

网友答案:

It's been a long time since you asked your question so I will answer for PhoneGap version 3.3.

You need to build your project for iOS with phonegap local build ios. Then the phonegap.js file will in $PROJECT_ROOT/platforms/ios/www directory.

Make sure you include phonegap.js in your index.html file, near the bottom so that it is after any dependencies.

<script type="text/javascript" src="phonegap.js"></script>

You may see warnings that cordova.js is not found, but this is ok as long as you have phonegap.js.

For reference, Apache Cordova is an open source project and PhoneGap offers some extra features on top of Cordova.

分享给朋友:
您可能感兴趣的文章:
随机阅读: