iPad apps. Exit(0) stay on 'taskbar' - objective-c

(ios 4.2)
When I force quit the application (exit(0);), the application quit, but the iPad "taskbar" doesn't seems to be refresh(app stay on it)
Do you have this behaviour? If no, how did you completely close?
(i know force quit are not "Apple friendly", but it's for a custom app)
Thanks!

Whatever the fate of your app's process is, its icon will always remain on the app switcher, as a "recently-used" app, until the user taps and holds, and removes it using the minus icon. I don't believe there's anything you can do to make iOS not display it there.
The process will already have quit, though, since you told it to exit(0).

Related

How to programmatically add a Dock icon bounce on launch?

I've been using Wineskin for quite a while, and, as of late, I've been attempting to use Winemac.drv (or Mac Driver) from CodeWeavers more than X11. The main difference is that Winemac is fully programmed in Objective-C (including its Window system), while the X11 approach uses X11 dylibs and .nib files for windows.
Since Winemac's still in development, however, it lacks in some OS X functionality*. The feature in mind is bouncing on Dock. What's the problem with the bouncing? Well, it simply just doesn't bounce. More specifically at launch. The code somehow overrides the user's option for "Animating apps on launch", or does something that completely ignores the usual app launching animation.
I've still very little experience in Objective-C, so I might've missed some key documentation from Apple's Mac Documentation Library, but my question is:
Can apps usually override this option, or might this be the case just for Wine? If they can, how?
EDIT: I've stated incorrectly that the Mac Driver missed on functionality, when the reality is, as mentioned by Ken Thomases, that Wine processes start at background, so no icon is shown on the Dock at launch, and that means no animation.
I'm the developer of the Mac driver for Wine.
The issue is that all Wine processes start life as background processes with no presence on the Dock. Many Wine processes remain that way because they never present any windows.
When a Wine process does present a window for the first time, it transforms itself from a background process to a foreground process. At this time, it gains a presence on the Dock and in the Command-Tab application switcher and gets a main menu bar. It just so happens that the Dock does not bounce the icon of an app which transforms from a background process to a foreground process. Basically, the Dock is getting involved well after the process was launched and bouncing is for a process which is launching.
An application can make its Dock icon bounce by calling -[NSApplication requestUserAttention:]. However, this does nothing if the application is already active. Also, the bounce animation has a different quality. It's sharper and more urgent, rather than a relaxed bounce.
Basically, there's no way to achieve what you want for the general case. It may be possible to construct a script-based app bundle that configures the environment and then execs Wine. Since the app is bundled and describes itself in its Info.plist as a normal foreground app, it will get a Dock icon immediately and that icon should bounce. I'm not entirely sure how things will behave from there, in terms of the execed Wine taking over the Dock icon. Even if it works for the initial process, any Wine processes which are launched by the initial process will revert to behaving in the manner you're familiar with. (For example, many games have a patcher/launcher which launches a secondary process for the game itself. You might get the patcher/launcher icon to bounce, but that wouldn't help for the game process's icon.)

geofencing no longer relaunch app from terminated state in ios7?

I'm developing an app which uses ibeacon to determine if the user entered a specific region.
Now I'm using the CoreLocation framework to implement this geofencing-based feature.
I've read the document below.
https://developer.apple.com/library/mac/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
in which the Apple is saying that:
"In iOS, the regions you register with the location manager persist between launches of your application. If a region crossing occurs while your iOS app is not running, the system automatically wakes it up (or relaunches it) in the background so that it can process the event. When relaunched, all of the regions you configured previously are made available in the monitoredRegions property of any location manager objects you create. "
I discovered that it's true just before the ios 7.
From ios 7, An app will be waken-up from background but it will actually no longer could be re-launched from terminated-state (slided out from the task manager which displayed by double-clicking the home button).
If it's due to the Apple's policies, why does Apple not update the above official document?
So I'm thinking of an ios7's bug because the Reminder App (a built-in app) is also not relaunched in ios7 even though it's relaunched in ios6.
Is this issue due to Apple's policies? or an ios7's bugs?
It takes me more than 2 days to google for a solution.
Any ideas for this issue?
The documentation is simply out of date. This is intended behavior in iOS7. Apple produced a video explicitly discussing this change. The idea is that if the user explicitly terminates the app, the user does not want it running. See this thread.
Is this such a big deal? How often will users really do this? Remember, if users are annoyed by you app, they can always uninstall it, too. This was true in iOS6.
iOS 7.1 reversed this policy. That is even if the user kills your app the iOS still launches your app upon crossing the region.

OS X Lion: NIB/XIB doesn't seem to get loaded if app is launched as a Startup Item

I have a problem which is driving me nuts.
Suppose you have an app with a window that is set to "Visible at Launch". When you launch the app, the window immediatly appears.
If you add this simple app to the login startup items list, when you log in, the app is automatically launched and you have the window just opened in front of you. This is what was happening in Snow Leopard.
If you repeat the same steps in Lion, as soon as you log-in, the app is launched but the window does not appear.. It seems that the NIB doesn't get loaded.
To make it appear you have to click on the app icon in the dock (even if the app is already launched).
This happens even if you specify [NSApp disableRelaunchOnLogin] according to Apple documentation here.
Things become worst if your app has NSUIElement = 0 and therefore it doesn't have neither an icon in the Dock, nor a Menubar. In this case there's no way to make the window to appear.
Is there a way to obtain the expected behavior of Snow Leopard? Am I missing something?

How do I play an alarm sound and present a custom view instead of just a notification?

I'm working on an alarm clock application for iOS 4.x. The other alarm clock applications that I've seen are able to present the user with something other than a local notification (i.e., a custom view) and are able to play a sound file. I've been looking into how that's done and have only found this solution:
Play sound with screen turned off / don't let iPhone go to sleep
Is there another approach or is this the best practice?
When your app is not visible, you can't display anything. The silent sound workaround is a cool trick but when a user presses your home button, your app is not visible (and might get destroyed under certain conditions) -> therefore you can't display anything.
So if you tell your user to use your alarm clock by firing it up and then press the sleep button it will work - you can display anything on your screen after the user unlocks the iphone again.
Needless to say that playing sound (even silent sound files) drains the battery so your user might be disappointed if he's not woken up because his iphone has run out of battery.
And yes, there is best practice: Local Notifications! Beginning with iOS 5 it will display your apps icon next to the notification...

iOS Multitasking App Launch

I developed an app for IPhone and it's posted to itunes for approval. Now when I test the app I found out a strange behavior which I think should be rectified. When I launch app first time, the app launched and when I press home button it closes but when I tap the app icon to open it again it opens where it was last closed.
How can I change the view to first view of the app when it's launched after closing by Home screen button?
If you don't want your app to run in the background you need to set the "Application does not run in background" key in the info.plist file. This means that your app will completely restart every time your user returns to it. Take time to decide if this really is the best move for your app. Allowing users to return to where they left off or remembering information about the last session can be a big plus.
If you do not set the info.plist value like I mention above you can manage the way your app behaves by using the: applicationWillEnterForeground: in UIApplicationDelegate or you could observe UIApplicationWillEnterForegroundNotifications. Read up on all the available notifications and methods available for this in the UIApplication Delegate documentation.