Combine Search Bar and URL Bar into One (WebView) - iphone

So I'm in the midst of updating my Web Browser app for iOS devices, from the ground up, and I'm trying to implement some more convenient features. One feature that seems to be really popular now, that I have been getting a lot of requests for, is the combination of a Google Search bar and a URL bar in one, like that of the Chrome application. Below is a screenshot of the Google Chrome app, and as you can see, they've made it so you can either enter in a search query like "apple ipad" and it will return a Google search page of 'Apple iPad', or you can enter in a URL "http://apple.com/ipad/" and it will load that URL.
I have looked all over the internet, but all I could find were tutorials on how to Search Google with value of the UITextField. I have a feeling that the best way to do this is to probably make a 'check'. Like if the entered value contains 'http://' 'www.' '.com' or no spaces, then load it as a URL, if not then load it in a Google Search page, and then have the webview load up the Google Search page.
If anybody could show me to the right direction, that would be great, or even supplying me with some code would be even greater. :)
Thanks! If anyone needs part of the code, just ask.

I have quickly coded up a class and uploaded it to my github account that you can use which is located HERE
I have also made a quick video on how to use this class which can be seen HERE
Hope this helps.

Related

Register app to open from Safari's "share" or "open in..." dialog not working. (though works from other apps)

I am trying to register my application to show up in Safari's "Open-in..." dialog when a user clicks the share button on any html webpage.
I have added the public.html (and public.data for good measure) content types to the Document Types in Xcode, as suggested in many answers: (See this question, this question, or this apple documentation.)
And, it seems to work. If I open a .pdf in Safari, I get the "open in My App" dialog at the top.
I can also use the "open in..." dialog from other apps to share the document with My App.
To test it, I built DocInteraction as recommended in this answer, and if I create an html file, My App shows up in the share dialog.
However, My App still doesn't show up in the share dialog in Safari.
When I run it in iOS7 on the iOS Simulator, I only get Mail, Twitter, and Facebook showing up:
The same goes when I test it on my real iOS device:
BUT, I would like you to note that it does seem to be possible! Look at the above screenshot.. SOMEHOW, Weibo has managed this feat. I don't know how, but for some reason Weibo shows up in this list even though My App doesn't.
And you know, actually, this sort of makes sense, given how many apps can probably open html pages. Here is DocInteraction running on my iOS device trying to share an html page:
There it is! My App! (It's actually called "Wulu Podify"). But there are so many apps who are hungry for .html pages, I guess Safari thinks it might be a bit overwhelming to provide them all.
BUT, this still begs the question, how did Weibo get themselves on that list? But, some further digging seems to show that actually Weibo seems to have gotten itself on EVERY list.
I'm not sure how they managed it, but maybe they are going about this differently.
Weibo's "I-will-open-any-document-you-throw-at-me-c'mon-try-it-c'mon" approach might solve this problem, but it's not ideal. I really only want to open html pages.
So. I guess my questions is three-fold:
Is there a way to actually have my app show up in Safari's "Open In..." dialog?
If not, how can I achieve what Weibo achieved, and show up in ALL the dialogs?
Should I want to do that? It seems like it might be a bad idea.
Thanks for any help! I've been at this for a while!!
Update:
So, actually, I didn't realize it but I think Weibo might be a built-in option just like Facebook and Twitter. I assumed it was just there because I have it installed on my phone, but maybe it was one of the iOS6 defaults. I say that because when I test on the iOS6.0 Simulator, I suddenly see Weibo show up in the share screen, even though I definitely haven't installed it on my simulator.
So maybe there is no way around this except for having it built in to Safari by apple..
I know this is years later, but if anyone runs into this old question, as of IOS 8, Apple now allows app creators to make "extensions" which do allow you to add your app to the share menus.
Here is some documentation:
https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html
I fear what you want is not possible.
There is a difference between the Share dialog and the Open With dialog.
For the latter it's possible to register your app with document interaction, but the Share dialog only provides the native types (which Weibo is one of - see here: UIActivityViewController).
Also see this question on StackOverflow: is-it-possible-to-add-an-app-to-the-native-share-dialog
its , called extension , fist create a new project and than -->
file ->new -> target -> application Extension -> ####
and select your required extension and done....

How do I develop my website to work with the "reader" icon on iPhone?

This morning I had a look at my blog on my iPhone and noticed that when I view a specific page a Reader icon comes up next to the URL in the address bar:
When I press it, I get an interface like this:
This functionality was completely unintentional (I wasn't even previously aware of it) but I think really nice, so I want to try and implement it intentionally on a few other pages on my website (and other sites that I work on).
How do I work with and enable this feature?
You don't need any work on your site. This is build-in feature on iOS Safari.

How to make web site that is compatible to mobile(Blackberry,Android,iPhone) screen sizes?

Hi I am developing a site for desktop.The site renders the contents for desktop size.But when I see it in mobile the content is not properly rendered.
How can I make a site that fits all mobile screen sizes say Blackberry,Android,iPhone, etc. Can anybody mention any articles. I know only HTML. Thanks in advance.
I remember looking into myself a while ago and finding this video tutorial on net-tuts+ to be a good starting point
It is hard to make a single site that looks good on both mobile and desktop. Resolution is not the only problem, the very way the user interacts with you site changes on a mobile device. That said, the typical thing to do is to have a mobile style sheet which is loaded for mobile, and a desktop sheet for desktop. You might even go so far as to limit some of your content on mobile to make the page lighter.
I found http://mobiforge.com to be a good source of info.

Simplest way to incorporate iPhone file upload when building app with Appcelerator's Titanium Developer

Sorry for the long explanation. Thanks in advance to all who are taking their time.
I am an Ubuntu user who has set up Titanium Developer on a MacMini in order to build an app for the iPhone (and ultimately some other platforms).
Rather than having any local code built in, the app simply points to my website. To do that, all I needed to do was change Titanium's tiapp.xml file to include my website URL. I wrote no other code, nor did I need to include any other files. It simply compiled and ran in the emulator without a hitch.
I've got just one problem: I need to upload files to my website and Apple, as most of you know, has disabled the input field type=file. I've got it working in all other browsers. The action simply calls a php file and passes the file info.
If I didn't have an app, and someone was just manually navigating to my site with the iPhone's Safari browser, I could get around the problem by using CliqCliq, which is a very cool iPhone app. Basically, I use JavaScript window.open() to launch CliqCliq's QuickPic browser in a second Safari window. The user chooses a file; QuickPic uploads it; and the user is returned to the second Safari window that I launched with window.open(). The user closes the window and Safari returns them to the first window (i.e., my website).
The problem is that my website is being shown in my app. (By the way, I don't have my developer license yet, even though I signed up a few weeks ago, and I can't test this in the emulator because I can't install QuickPic into it, I assume.) I wanted to repeat the same steps, described in the previous paragraph, using an iFrame but that didn't seem to work (i.e., the iFrame was blank despite my designating a src). I also tried having a hidden window by using old-fashioned frames and setting the col-width to 0. That also did not work (i.e., Safari, if I recall correctly, opened a separate window).
I'm working a little blind, since I can't test anything on the iPhone, but I figure I have two options: I can either find a way to launch a QuickPic in an iFrame -or- I can find some way to incorporate the Apple toolkit file chooser into the Titanium app.
The problem with the first option -- but again, I don't know until I can try this on the iPhone -- is that I assume both apps (mine and CliqCliq's) could not run at the same time. Even if I had a hidden window, invisible iFrame, etc., the moment it launches QuickPic, I assume my app would quit(?).
The problem with the second option is that I don't have clue as to how to incorporate a file picker into my app by using Titanium (keeping in mind, everyone, that I know very little). Brian at CliqCliq has even offered to give me some code if I can't make Apple's file picker work but again, I'm not sure what to do next.
What do you folks think? What's the best method? And, what's the easiest thing for a simpleton to do?
Thanks.
<input type="file"> is not supported on the iPhone. You'll need to use Titanium's APIs, specifically the Media one (openPhotoGallery or showCamera).
As a side note, Apple reportedly rejects apps that are just a webview displaying a website. You may want to consider putting most of the app code in local storage and using AJAX to fetch content.

Google Adsense within native cocoa-touch iphone app

My planned iphone application will work a remote https web service quite hard so until a user decides to upgrade from the free to pro version of my app I need to generate a trickle of click revenue per free user.
I would like to embed a single line adsense widget within a native cocoa-touch iPhone application. The UI control I have in mind might not exist but would work something like this. The control would occupy a fixed portion of my application's default view and would be initialized by my code and provided with key words determined by my application. The control would then periodically ping Google's adsense system and display a single clickable advert link.
If the user was interested in a link a click would result in an exit of my application followed by the opening of the advertiser's link in Safari.
Has anything like this been done before?
You have to use a UIWebView with a Adsense unit inside it. I think when you are setting up a ad unit you can enter keywords.
This is most probably a violation of their terms, though. It may be a better idea to try using something else like http://www.admob.com/.
Since AdSense requires the content of the page it's on to serve up relevant ads, you're likely to get nothing but PSA ads, since Google can't crawl your app.
And like Isaac says, I'm sure it's against the AdSense terms.
Google's Mobile Adsense is on the run:
TechCrunch article