Iphone Multiple localnotification - iphone

I face a very weird experience, when i receive multiple notification and then didn't response to it immediately. After a while, i pressed the view button and it open my application and show black screen.
BTW, the application is running at background when i click the view button and it also doesn't trigger didReceiveLocalNotification.
Does anyone know what is the problem?
Thanks

When your application is running in background and if notification come, then it will call applicationFinishLauchingwithOptions Method. So write your logic in that part.

Related

App screen turn white while receiving notification

This is so weird, I've looked and nobody has the same problem as I was.
So, I noticed my app suddenly turn into white screen for few seconds when have incoming notification, this notification from other apps like facebook, whatsapp, etc. But it confuses me, why it effect my app when notification shown in the top screen for like 3 seconds, and my app turn into white except the notification.
This happened on iPhone 5 (iOS6). never happen before on iOS5.
EDIT
My app doesn't register notification, notification comes from other application, which nothing to do on my app. that is the strange one.
By pulling down notification also my app turned into white.
-<>-
So I fixed my own problem. anyone face same problem like I was, can see this solution :
The problem is caused by duplicate window in in App delegate xib. which I might added accidentally into it, Silly of me.
Second window is just empty, unused. contain only white background - which is why this was shown when app received notification or by pulling down notification bar.
by removing it will solve the problem.
I think you call a thread when notification is occurred, Or when notification appeared you call multiple thread with work on views push or pop or hevy load the data , please check on instrument and leak first and resolved the allocation problem and check with notification in second part.
let me know if you have any issues.

How display an alert/ (Rating alert) just before app going to close/ backward in iphone objectivec

In my window based iPhone application i have developed a rating alert using iRate to rate my application. it displays an alert view.
this alert was displayed when app launches.
But i need to display this alert just before the app going to close when a user has selected to press the home button to exit the app.
it displays only 0.5 secs so it is invisible so what to do .. i tried it in applicationDidEnterBackground & in applicationWillResignActive and in pplicationWillTerminate but no use
what to do thanks in advance...
You can't do this. When your app gets the applicationWillTerminate or applicationWillResignActive messages, your app has a limited amount of time to do cleaning up processes before the OS kills it. Displaying a message will delay the exiting of the app and so it isn't allowed - it will just display very quickly and then the app will be killed because it hasn't finished.
If a user has selected to press the home button to exit the app, they want to exit the app straight away. They don't want to exit the app some time after they've pressed it just because you want to show them some other things.
applicationDidEnterBackground: is the method you can use to know when you're app will be backgrounded. You only have 5 seconds to return from this method though so it may not be the best place to show an alert view
If you love your users, don't show rating alerts. Create a great app to get great ratings.

Send App to Background process

We do not want to use exit(0) to make the app close, we do however want to allow the app to go to background programmatically and process away, per users allowing this action. Is there a way to send the app to the background programmatically without exit? Simulating the click of the home button?
Thank in advance!
Is there a way to send the app to the background programmatically without exit?
No. The user is supposed to be in control of the app -- the app shouldn't move to the background (or exit) of its own accord.
Not possible. Home button clicks run into the private GSEvents framework. It's exit() or none unfortunately.
The below code can be used to send iOS app to background programatically without exit
DispatchQueue.main.async {
UIApplication.shared.performSelector(inBackground:NSSelectorFromString("suspend"), with: nil)
}

How to ignore a local notification when iPhone is locked?

I am implementing a voip app for iphone. Upon receiving an incoming call, the app shows a local notification with two buttons : close and answer. If the user clicks on answer, the app shows in foreground and the call is answered, and if she clicks on 'close', the call is ignored.
The problem, however, is that when iphone is locked, there is no 'close' button, only a slider for which sliding from left to right means 'answer'. Hence there is no way to ignore the call.
Is there a way to solve this? The only solution I found so far is to show another notification for the user to answer or reject, but that seems inconvenient to use.
Re-locking the screen (using the sleep/lock button) usually constitutes ignoring a notification. Have you tested whether your app receives some kind of message when that happens?

Crash when receiving call while playing audio

I am working on an online radio and it works fine, but gets problem when user received a call. When call finishes I start the radio automatically, by using AVAudioSessionDelegate.
Now radio is playing and if user open the app (moving it to foreground) and press that stop/play button again my app goes crashes. I might know the reason, the reason may be due to threading. But I am unable to handle this (I can't put the code, it is huge and private).
To prevent crash when your app goes in background and comes in foreground, call the pause button of radio app in background and releases threads. when user touches the play button it it will start threading. Try it,hopes it may work for you.