PhoneGapHtml5_Problem - iphone

Just wanted to ask u how do we link HTML file in PhoneGap Applications.As u know that in when we create PhoneGap application one Html file comes with it i just want to know how it is linked to the application so that i could add more Html files to it and use it ib webview
Thanks all in advance

To use multiple pages you can just link to them as normal. (Remember, use relative links).
It's hower normal to use only 1 page in phonegap application. 1 page that uses hidden divs. Don't really know why, besides the fact symbian only supports 1 page with acces to the device.

Just place your HTML files and other resouces (like images, scripts, etc) inside the "www" folder :) as Erik said, just link them as yoiu normally do. You don't need to edit any Objective-C files (like .m or .h).
Good Luck

PhoneGapDelegate.m is where the phonegap settings are stored. The PhoneGapViewController.m is where the UIWebView is bound to the xib.

Please control click on any web view delegate method placed in App delegate method then in the new class which appears after contrl clicking make following changes...
(NSString*) wwwFolderName { return #"www"; }
(NSString*) startPage { return #"index.html"; }
In these 2 functions i.e wht html file u want to attach in your phone gap u can write the name in start page function as shown above.

Related

How to check if any apps are associated with file extension

I want to make "Open in.." function in my iOS application.
Is there any way to check if any app on this device is associated with file extension that i want to share?
If there are no apps on current device to open file with such an extension than UIDocumentInteractionController will not be displayed after clicking on "Open in.." button, but i want not to show this button in such case.
So the question is: how to check if any app on device can open some file with specific extension?
Update:
For example UIDocumentInteractionController has NSArray property icons.
It contains images of all aplications that can open the file with my extension. But if there are no applications it contans image of empty application.
So i can't check it using docInteractionController.icons.count == 0 for example. I am looking for other tricks.'
Thanks, in advance.
Although UIDocumentInteractionController does not offer a way to discover in advance whether there are any applications that can handle a document, -presentOpenInMenuFromRect: will return a flag indicating whether there were any applications that could open a document. This requires you to have already set up and presented the controller, which is not optimal.
There is a workaround for this, a little hacky but is functional: Before you invoke the "real" interaction controller, create a dummy one using a dummy document, and present it from the rect of the window's bounds. This guarantees that it will "appear" offscreen, so your user won't see it. At that point, you have the flag returned from -present, and you can immediately dismiss the dummy controller, and the proceed to show your UI appropriately.
On OSX, you can get a list of application bundle identifiers capable of handling a specific content type using LSCopyAllRoleHandlersForContentType. But on iOS, I don't think there is such a way.
If I find, I'll edit my answer.
Considering you are looking for other tricks, you can check if that one image in the icons array is the generic document icon.
If it is then you know that there is no app associated to handle that file type. But this approach will be OS version dependent as generic file icon may change.
From the official documentation:
To declare its support for file types, your app must include the
CFBundleDocumentTypes key in its Info.plistproperty list file. (See
“Core Foundation Keys”.) The system adds this information to a
registry that other apps can access through a document interaction
controller.
To me this indicates that the registry can only be accessed through UIDocumentInteractionController and so no, you would not be able to know in advance if there are any available apps for the file format (which would be totally in line with Apple's philosophy of not letting apps interact directly with each other).
UPDATE:
as you said the icons property contains an image even with no applications present. I checked and all the other methods and properties of the controller do not give an hint about the apps that may open the current file format.
You said in case that no app can open the specified file format there is an "image of empty application". Maybe you can extract that icon and when the array icons only has one image check if the extracted image and the icon are the same?

Open Mail.app on IPhone from webpage that's INSIDE an app

our app loads profile pages from our website INSIDE the app. They have been optimized for iPhone css, but they are still an html page. Our mailto link isnt working as expected.
When clicked, nothing happens. However, when clicked and held (tap and hold), the menu slides up with "new message", "create new contact", "copy", etc.
How should this be formatted to get the Mail.app to automatically launch?
<a class="action_bubble" target="_blank" rel="external" href="mailto:bob#bob.com">Send Email</a>
The "call" link works as expected.
<a class="action_bubble" href="tel:1234567890">Call</a>
So, not sure what to do with this...
Here is a project on GitHub that addresses your issue. Basically, when you use a UIWebView controller, you need to decide how to manage the links using the delegate handler for UIWebView. In Interface Builder you can have it automatically recognize phone numbers which is probably why your phone numbers work and it will recognize http links as default behavior. However, mailto and some of the other special href options will need to be handled manually.
make sure "Detection" property is set for your UIWebView like "Phone","Address". you can set it from your IB.
or from code
self.webView.dataDetectorTypes = UIDataDetectorTypeAll;
Could it be, that you have just tried within the simulator? The simulator does not have a mail app, so it couldn't be opened. Try on a device. I think your code actually works.
I've just tested on a device: your code works.
A little late to the party but I've found out the following:
iOS has some weird ways to deal with web content
DON'T encapsulate your email address within an A tag, just put it there as plain text
Make sure that in your storyboard (if using one) the webView has the Addresses property checked and you're done ... same goes for phone numbers

iphone webview show html with images and css file

I found some interesting URL http://cubiq.org/rotating-wheel-for-your-iphone-webapps which has rotational menu. Its good. It has html file along with images, css files etc.
In iPhone app, I copied (to root folder) all the files and imported to project. I'm using UIWebView's load request to load the html. But I'm not getting the rotatable menu.
Can some one post me the code (or tutorial or prototype or example) on how to use it?
Also let me know how to catch the even on click on "OK" button at the middle of the html.
Thanks in advance.
checkout IUI : http://code.google.com/p/iui/

How to Show a GPL licence in iphone application bundle

i am making an app for iphone and for that i am using certain free libraries.My problem is that i want to show their complete license of nearly 4-5 pages in my application bundle so that a user can open settings in iphone and see that licensing page at one time but i am unable to do it.I have read these Specifiers for making an application bundle .
PSGroupSpecifier
PSTitleValueSpecifier
PSTextFieldSpecifier
PSSliderSpecifier
PSToggleSwitchSpecifier
PSMultiValueSpecifier
PSChildPaneSpecifier
but i want to show a page full of text like Settings->General->About->Leagl
just like in iphone through PSChildPaneSpecifier .Please help me how to do this>???
Thanks
You can create the same effect as used by Apple's iWorks apps for the license > section of the settings, without using any custom preference controller. Note this works for iOS 5 on the iPad, I have not tried it elsewhere. Use a PSChildPaneSpecifier for the initial control in the root plist. This points to the name of another plist file which will be the displayed child pane. You do not add .plist to the name within the root.plist file, it is implied. This plist file must be within the settings bundle. Next, use PSGroupSpecifiers in the child pane as the controls. For each paragraph use another PSGroupSpecifier - so the thing will scroll. Only use the Title section of the PSGroupSpecifier. The next gotcha that I found, was that by putting the strings in the plist file, the text was clipped in portrait orientation, so a placeholder string needs to go in the plist file and a StringTable used to point to a strings file. Text read from the strings file is properly kerned and displays without clipping.
The iPhone's "Legal" page is a custom preference controller which you can't use (not even with undocumented methods – you need to write a preference bundle in system locations which AppStore apps can't reach at all).
If you'd like to display the license, show it in the app.
I think you are going to need to use something like a UITextView, just make it non-editable. You can make in unobtrusive in your app but I think that is the only way to have 4-5 pages.
I don't think there is a nice way of displaying this in the preferences bundle. Personally I would either provide a series of url links or bring the preferences into the app itself. There is a good framework on github here that you may be able to modify.

Launching Safari in-app?

Is it possible to Launch Safari without having the app close? Just like the in-app email compose window.
I'm aware of how to display a webpage in UIWebView. I'd like to use a full web browser, i.e. Safari.
You can use a UIWebView to display web content in your app.
You can create a UIWebView with the URL to display. It will follow any links that the user touches, but that won't give you the address bar, search, navigation buttons, bookmarks or the page (tab) control. Those you'll have to add yourself, but odds are you don't want all of that. (Do you really need Google searches in your app?)
Creating a controller to manage a UIWebView and as much or as little navigation as you need is pretty easy. With a little planning, your custom controller class will also a good thing to keep in your library for the next app.
No you can not make use of the full Safari from within your own application. Your application must terminate for Safari to open.
In iPhone OS 2.0 you also had to terminate in order to send e-mails, so some chance exists that Apple couls open up Safari in the same way for iPhone OS 4.0. Make sure to request it at http://bugreport.apple.com if you are eager.
The second best option currently available is to roll your own "Browser view controller" using UIWebView. Let it have back, forward, stop/reload buttons, and an extra button for opening in Safari if the user is not content. This is how many of the greatest apps our there, like Tweetie, does it.