Exit an application on button click in iPhone using PhoneGap - ios

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.

Related

Launch an app from within another without scheme(iOS)

Is it possible to launch another iPhone application or appstore from within another app?, For example in my application if I want the user to open another of my application from current app. (close/minimize the current app, open the Phone app). We searched and found its possible with SharedApplication. But it requires to update all our apps. We posted without customUrl or schemes. We are using Objective-C.

Opening external app from custom keyboard ios 8

I wanted to know how I can open an external app from a custom keyboard in iOS 8?
is it by example possible to open Facebook, or post a Facebook message from a custom keyboard, if yes, how can I achieve this?
Thank you,
joe
I was trying to work with the UIApplication sharedApplication openURL: method in order to open the AppStore to link to the app so user's could rate it, Xcode kept telling me that the openURL method would not work in the extension. So I am sure you are able to refer back to the app itself but not open other app's which hopefully they will be able to change fairly soon.

Launching a different ios app, within an app

I'm writing a basic application using xcode 5.1. One of the features I'm interested in trying to do is to launch another app or move to other part of iphone, INSIDE the app already running.
Eg. I have an app with 3 menu options, 1 and 2 do certain tasks as part of this parent app, menu option 3 launches another app that's installed on the phone. I'm not sure if this is possible?
No you can not do that. Besides the documented URL handlers, there's no way to communicate with/launch another app.
This is part of the sandbox principle of apple:
https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/TheiOSEnvironment/TheiOSEnvironment.html
What you can do is launch another app by using custom URL-Schemes
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/

How to open downloaded application, when it is downloaded from itms-services?

I have to write my code such that, i want to open downloaded app from current application,
I have URL Scheme of downloaded app, and able to open that app from current application,
But want to open app immediately whenever it is downloaded, also want to know if download is
canceled or any error is occured.
Can you please help me in this case.
Thanks.
Abbas
There is no notification that would ever tell your app that some other app has been installed.
Your only option would be to use UIApplication canOpenURL: once in a while to see if the app exists and then launch it if appropriate. But getting this right would be complicated.
You can't. The sandbox does not allow you to interact with other apps except to invoke them with a custom URL scheme.

App as shortcut for website

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);

Resources