HelloPhoneGap1.0 Project Created – Compatible with iOS 5, PhoneGap 1.0, and XCode4
I just created a new project HelloPhoneGap1.0 with the code out on github so that it works with PhoneGap 1.0, iOS5, and Xcode4 with the new project structure. Let me know if you see any issues…
Look for an upcoming post that details the changes in the project structure and how to go about extending and updating the PhoneGap library in the new project.
Where to get the Code? (PhoneGap 1.0 Required)
You can get the entire source for my sample project “HelloPhoneGap1.0” from github here: https://github.com/hutley/HelloPhoneGap1.0
Categories: iOS, Mobile Development, PhoneGap
Hiedi,
Am I supposed to copy the whole project and open it with Xcode, or create a new Xcode project and then replace the files with yours? (Tried both with no success…)
Thanks,
Roberto
You should be able to just open the project with Xcode4. Make sure you have PhoneGap 1.0 installed. Also, I just pushed an update that fixes up the build path so maybe that will help you too.
Hiedi, thanks for your tutorials…they’ve been tremendous help to me.
I’ve actually been working on ChildBrowser for over a week and have had no luck so far. Actually, opening your updated 1.0 project this morning has been the only one that has made a successful build for me.
While ChildBrowser and NativeControl seem to work well, I do get these build issues. Any ideas on how I fix them?
/Users/ryan/Desktop/hutley-HelloPhoneGap1.0-d7388fa/HelloPhoneGap1/Plugins/ChildBrowser/ChildBrowserViewController.m
/Users/ryan/Desktop/hutley-HelloPhoneGap1.0-d7388fa/HelloPhoneGap1/Plugins/ChildBrowser/ChildBrowserViewController.m:111: warning: 'UIViewController' may not respond to '-presentingViewController'
/Users/ryan/Desktop/hutley-HelloPhoneGap1.0-d7388fa/HelloPhoneGap1/Plugins/ChildBrowser/ChildBrowserViewController.m:111: warning: no '-dismissViewControllerAnimated:completion:' method found
file://localhost/Users/ryan/Desktop/hutley-HelloPhoneGap1.0-d7388fa/HelloPhoneGap1/Plugins/ChildBrowser/ChildBrowserViewController.m: warning: Semantic Issue: Method '-presentingViewController' not found (return type defaults to 'id')
file://localhost/Users/ryan/Desktop/hutley-HelloPhoneGap1.0-d7388fa/HelloPhoneGap1/Plugins/ChildBrowser/ChildBrowserViewController.m: warning: Semantic Issue: Method '-dismissViewControllerAnimated:completion:' not found (return type defaults to 'id')
warning: no rule to process file '$(PROJECT_DIR)/HelloPhoneGap1/Plugins/ActivityIndicator/ActivityIndicator.js' of type sourcecode.javascript for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/HelloPhoneGap1/Plugins/ChildBrowser/ChildBrowser.js' of type sourcecode.javascript for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/HelloPhoneGap1/Plugins/iPod/iPod.js' of type sourcecode.javascript for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/HelloPhoneGap1/Plugins/NativeControls/NativeControls.js' of type sourcecode.javascript for architecture i386
You are receiving the warnings for presentingViewController and dismissViewControllerAnimated b/c they are specific to iOS 5.0 SDK. There are checks in the code so that the ChildBrowser will work on both iOS5 and previous versions. You can ignore them
For me it seems I figured out the “warning: no rule to process file”
As long as I keep .js files in www, then I removed them from the plug-in folder, everything went ok.
Still no idea on the others though
The warnings on the js files are b/c they are listed in the compile sources in the build phase. They can be ignored but I did check in an updated project that gets rid of them.
Thanks for posting this, your sample code is very helpful.
I’ve been having some trouble with watchPosition in PG 1.0.0 (using Xcode 4, with jQTouch for the UI), and I thought I’d ask for your advice. Would it be ok if I shared my code with you (it’s not too complicated, but maybe too much for a comment box).
Also, I noticed two things in your HelloPhoneGap1.0 example that I wanted to clarify. In your geolocation.html example, you use the “frequency” item in your options array. But the PG API Docs say this is not used anymore; it should be replaced with maximumAge. Do you know if your example actually uses the frequency value, or is that just ignored?
And a user claims to have identified a bug with the watchPosition code in phonegap-1.0.0.js. He explains it here: https://github.com/phonegap/phonegap-iphone/pull/222 But when I incorporate his fix into phonegap-1.0.0.js in your example, it makes no difference; your geolocation example still works the same. When I incorporate it into my application, the watchPosition behavior definitely changes after I integrate his fix. So I’m confused
. Any thoughts? Thanks!
The frequency option is to be removed in the future per this link http://docs.phonegap.com/phonegap_geolocation_geolocation.md.html — looking at the objective-c code though it appears that it may already be unused. I added in the fix you specified and it caused my geolocation not to work at all – but reverting to the base phonegap.js seems to work just fine so not sure what version of the file that is needed for those changes.
Hey I tried the sample but when I run it on my mobile the bar at the bottom says “waiting for PhoneGap to initialize…” that message never goes away. Also while the UI is responsive none of the API calls do anything… I’m using Phonegap 1.0, with iOS 5 beta 6… I’m also seeing messages in my int main “NSAutoreleasePool is unavailable: not available in automatic reference counting mode”
Is the latest PhoneGap not compatible with iOS 5 beta 6?
The ARC messages are related to new features in iOS – you can ignore them. As for the “waiting for phonegap” to initialize – this typically means that you didn’t include the proper js files or you have a script error on the page. See my “Debugging” post from 5/18 to investigate further – also — if you recently downloaded the HelloPhoneGap1.0 files – try and clone them again. The phonegap-1.0.0.js may have been corrupt before.
Hi Heidi,
I’m new to this whole phonegap thing and am having trouble on new Media(src), so I thought I would give your app a trial as a working demo but I am getting the following
I’m using XCode 4.2 Build 4D199, and Phone Gap 1.1.0
ActivityIndicatorCommand.m
‘ActivityIndicatorCommand’ may not respond to ‘-appViewController’
file://…/phoneGap/HelloPhoneGap/HelloPhoneGap1/Plugins/ActivityIndicator/ActivityIndicatorCommand.m: error: Automatic Reference Counting Issue: Receiver type ‘ActivityIndicatorCommand’ for instance message does not declare a method with selector ‘appViewController’
ActivityIndicatorCommand.h
Cannot find interface declaration for ‘PGPlugin’, superclass of ‘ActivityIndicatorCommand’
I’m not quite sure how to troubleshoot this.
It sounds like you don’t have PhoneGap installed. If you do, check XCode preferences settings and make sure you have the PHONEGAPLIB setting set to where you have PhoneGap installed (Xcode -> Preferences -> Locations -> Source Trees)
i have installed phonegap 1.1.0 and pretty much nothing works .. every object exist .. but i think the phonegap.exec does not work on iOS 5 .. any idea?
Could use some more details. I have not yet upgraded my project to work with 1.1.0 yet so send me your errors…
well in 1.1.0 .. pretty much nothing works .. like accelerometer, sound/vibrate, compass, notification, thats all i tested before giving up
the only thing that really worked was “device” and “connection” that was correctly giving me “wifi”
but other than those 2.. nothing worked
The errors are because the project is probably set to use the Apple LLVM Compiler and you have the ARC turned on — you can turn this off by changing the options under the Apple LLVM Compiler in build settings. OR you can download my latest git repo – I just updated the project there as well so the errors go away.
I just downloaded and tried to run your project from github… I’m getting this error on the ActivityIndicatorCommand.h file.
cannot find interface declaration for ‘PGPlugin’, superlass ‘ActivityIndicatorCommand’
Make sure you have phonegap 1.0 installed.
Okay, ya that fixes it. Does the ChildBrowser plugin need to be updated to run on PG1.1.0?
so anything with phonegap 1.1.0 isn’t working .. right? because with phonegap 1 .. everything works .. but 1.1.0 nothing ever works :/ .. this is kind of a deal breaker for my company to use that software
Did you get an answer to your issue? I am having the same problem with phonegap 1.1.0.
I updated the code on github for PhoneGap 1.1.0. Try updating.
It should work. I have updated the sample project out on github for 1.1.0. Try again.