App as shortcut for website - ios

I want to create an app that will act as a shortcut for my website.So basically what i want to do is when user click on app icon it opens my website in safari or other browser and close the app.
I know its not recommended to close app as per apple guideline but i want to do it gracefully like it opens browser now its work is done; close the app.
Does anybody have any idea?
I can open the browser using
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"myurl"]];
but don't have any idea on how to close app gracefully.

Note: you can NOT do the following in iOS apps (2016):
You can close your app by using this code.
exit(0);

Related

Push notification to alert for Enterprise update?

Are there any suggestions for the feasibility/correctness of this solution? Enterprise app with quarterly updates. Client unwilling to use MDM solution.
Using push, alert the app of an update. An action on the notification or just opening the app pops a modal with a button to open Safari to download the updated app (url is in code). Modal has login info next to the button.
Safari opens, I copy and paste from the modal or just remember the login info. App installs. I reopen and the notif. is gone because a fresh install happened so no need to remove it.
Has anyone done something similar?
If I undestand you right, you can explicitly open URL to manifest of your enterprise build right from your application code instead of opening html page with exactly the same url inside.
NSString * urlString =#"itms-services://?action=download-manifest&url=https://mywebsite.com/path_to_distr/manifest.plist"
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
This will launch the update process.

open last used app from current app using Custom URL Schemes

Am I able to open app from browser using Custom URL Schemes, now I need open a browser back this app after click cancel button in app. how can I open a browser? is it possible?
are can we open last used app from this app?
You can open safari back with below line.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.google.com"]];
However it will not open the browser with the state from where it went into background.
We can not open last used application. We can open it only if we know its custom URL.

How to open any iOS App from my own App

What I want to do is open any iOS Application (Evernote, safari, Facebook, etc) from my own iOS application. For example, I have created my app with two simple buttons, the first one is named "Evernote" and the second one is named "Safari", so when I click on the "Evernote" button I want that the Evernote App launch on my iOS device, the same when I click on the "Safari" button I want that the button opens my Safari App. How can I do that? It is that possible? If it is, please tell me how. Thank you very much.
yes it possible if you known this app scheme reference URL.
Example call Tel app:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tel://"]]){
NSString *tell = [#"tel://" stringByAppendingString:phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:tell]];
}
Safari and other is same way.
List common schemes Url here : http://wiki.akosma.com/IPhone_URL_Schemes
Hope this link helps you.
http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629
If you need to open external apps from your app then follow the above link. Or if you need to open the iOS native apps like phone, mail, safari, etc, you can use URL schemes for opening the app.

Exit an application on button click in iPhone using PhoneGap

I'm using PhoneGap in Xcode. The problem is that I want to quit application when user clicks on Logout button. How can this be achieved?
Is there any alertnative that objective-c code can be used to quit application?
You don't have to launch open using NSTask... open just calls into Launch Services, some of whose functionality is directly available from NSWorkspace.
To quit, you just call [[NSApplication sharedApplication] terminate:nil]. See NSApplication documentation.
You're technically not supposed to exit the application if you're planning to submit your App to the App Store.
See here: https://developer.apple.com/library/ios/#qa/qa2008/qa1561.html
Perhaps, you should bring the user back to some sort of login/landing page instead.

Automatically open an app within iOS

I'm currently developing an app for iOS and I've got a list of PDF files in the app which I want to be able to open (and show).
Now I do know you can do that with the UIDocumentInteractionController, which then shows what apps are able to open the specific file, but I'm looking for a solution where I can open an app (e.g. Adobe Reader) without first having to open the UIDocumentInteractionController, tapping the app I want and then opening it.
Is this possible? And if so: how?
Thanks in advance!
DckWlff
You can have a look at URL Schemes. But the app you want to open needs to support it.
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
You can open an app in your App like this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"myapp://"]];
Edit:
You can find some schemes here: http://schemes.zwapp.com

Resources