Вопрос

I have a basic query while developing hybrid iPhone application

1) How can we access iPhone native functionalities like GPS from web UI javascript WITHOUT help of third party frameworks like quickconnect iPhone or PhoneGap

2) What is the flow , architecture for the same? i.e. how javascript communicates with the native code.

3) All comments, URL, information for the same are most welcome!

4) Can I upload my app on appstore using quickconnect?

5) I think using phonegap, we cannot upload on appstore, we have to upload on phonegap only. plz comment

Thanks

Это было полезно?

Решение

1) How can we access iPhone native functionalities like GPS from web UI javascript WITHOUT help of third party frameworks like quickconnect iPhone or PhoneGap

Check out the HTML GeoLocation API. Apple also exposes other cool stuff like accelerometer data via JavaScript APIs. So you don't always even need native code.

2) What is the flow, architecture for the same? i.e. how javascript communicates with the native code.

Actually, for some information, like location data, you do not need native code (see above). However, in general, if you want to communicate with native code from a WebView in an iPhone application, you would usually register a URL handler in the WebView's delegate, then do some fancy tricks with window.location to trigger the handler when needed. To send data back to the WebView, you just need to use the self-explanatory [webView stringByEvaluatingJavaScriptFromString:(String)] method.

For communication like this, I usually end up writing my own little library that allows me to call certain native handler methods from JavaScript and also register to receive messages from the native code. You'll probably end up doing the same. It's simple, intuitive, and fun. I recommend the experience.

3) All comments, URL, information for the same are most welcome!

See the links above.

4) Can I upload my app on appstore using quickconnect?

I've never used quickconnect so I can't answer that one.

5) I think using phonegap, we cannot upload on appstore, we have to upload on phonegap only. plz comment

I've never heard of people having trouble with posting a PhoneGap based application to the AppStore. Though I must admit I've never attempted it myself. I imagine that I would have heard if Apple had stopped accepting PhoneGap based applications. But Apple is pretty moody. So who knows?

(I'd check on my sources on that one if I were you, though)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top