How to kill an app in iPhone using objective C [duplicate] - ios

This question already has answers here:
Proper way to exit iPhone application?
(24 answers)
Closed 9 years ago.
In my app I am having a continuous communication with TCP server , now if
server sends a command to close the app, i want to close the app completely
and when user taps the app again, it should start with Application launch method itself.
I have tried using exit(0) in the code, using this application goes into background.But it doesn't kill the app. How can i do that?

There isn't a way. Apple doesn't allow it. The solution is: Just accept the fact that you are unable to do this and work around that fact.

Related

Swift: Is there a way to get the running apps in IOS? [duplicate]

This question already has answers here:
How to get information about free memory and running processes in an App Store approved app? (Yes, there is one!)
(2 answers)
Closed 5 years ago.
Is there a way to get the running apps info or the action of openning the app in IOS? There is a way to do that in android with getRunningTasks, maybe there is a way to do that in ios?
At last in non-jailbroken iOS there is no such possibility. The reason is to protect users privacy - app should not know about other apps that are installed on user device (otherwise it could eg. spot business rivals app).

Swift iOS 9+ before app closes/before app opens [duplicate]

This question already has answers here:
Save the current status when quit, auto-reload when re-open the app
(2 answers)
Closed 6 years ago.
I want, using Swift in iOS, to capture a variable before the app closes from a subview and place it in storage, and prior to the app gets too far along on re-open restore this variable.
I know how to get and set, I just am hoping to stumble across the events that trigger before the app closes and shortly after it launchers.
You should do this in the AppDelegate.swift file.

get the information on the last closed iOS App

I am working on an iOS App and have stumped on one of the odd requirement that my client would like to have. We want to exit from app A and open app B then close app B and open app A again, We are trying to get the name of the app B which was closed recently. Is this something that can be done? If yes, how do I accomplish this?
Thanks for all of yours help!
It is not possible to get the last closed iOS app, but if you have two apps and you want to be able to move between the apps you may be able to use URL schemes. URL Schemes Documentation Here: http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW18

Log method entry and exit Objective C [duplicate]

This question already has answers here:
How to log all methods used in iOS app
(8 answers)
Closed 10 years ago.
I have used NSObjCMessageLoggingEnabled for logging the method entry and exit at run time for an application. THe logs has been saved in /tmp/msgSends-pid. Whre pid is process ID.
I want to save same logs while running an app on the iPhone device instead of running app on emulator using Xcode.
Please let me know if you require more details to help me out.
NSObjCMessageLoggingEnabled appears in Apple's technical note about Mac OS X debugging magic, but not the one about iOS debugging magic. It appears that it is unavailable on iOS.
Apparently, you can log Objective-C method entries and exits using a DTrace probe in Instruments.

iOS purgeIdleCellConnections [duplicate]

This question already has an answer here:
purgeIdleCellConnections: found one to purge conn = 0x1d57ba00
(1 answer)
Closed 9 years ago.
I'm getting a list of purgeIdleCellConnections shortly after downloading a lot of png images from the internet from a model class in the app.
Is this a threat to the application? It doesn't freeze up. Should I manually be closing connections?
Thanks!
xcode 4.2.1, ARC, deploying to ios 5.0+
EDIT: I'm seeing the list in my console. Also, I only see it when testing from my phone on a 3G network, not on wifi. Doesn't happen in simulator either.
I have no idea where you're seeing "a list of purgeIdleCellConnections".
If you mean in the Organizer console, it's probably normal: You've just stopped downloading stuff, so presumably there are now a bunch of idle cell network connections which can be turned off to save power (that's my take on it, anyway).

Resources