Application Crashes When Dismissing Modal View Controller - ios

There's somewhere in my app that I dismiss ModalViewController and it causes app to crash with the following log :
-[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]: message sent to deallocated instance 0x5c92640
Can anybody help me finding what the problem is please ?
Any suggestion's really appreciated.
P.S: Here's the full scenario : My app presents a Modal View Controller when it receives some kind of notifications ( Incoming call request ), and if the call is being ended before user accept or reject the call, the view controller is being dismissed automatically. However this is what happens in foreground. When the app is in background, if the call end before user enter the app, that "Automatically dismissing view controller" causes this crash.

Related

AppDelegate: Show blocking view when something changes

I want something similar as the view shown in the "Friends" app when the iPhone is in flight mode. So my app shouldn't be usable when there is no internet and/or GPS so an empty view with an info message should pop up telling this the user. And of course vanish as soon as the internet/GPS is recovered. How can I do this?
EDIT: I know the reachabiljty class I only wonder how can I show and hide a view created in Storyboard directly from the app delegate?

Loading the last View Controller Active after app goes into background, swift

I have "Tinder" like swipping view that is located in a CardViewController. The card View Controller is accessed by moving through two other view controllers. i.e. Load App -> FirstViewController -> SecondViewController - > CardViewController.
When I am in the Card ViewController and I go into background mode, the app launches on the FirstViewController and on going to the cards, they are loaded from the first card in a stack of about 10?
Is there anyway to load the app from the last Card I had swipped and in the CardViewController without having to navigate from the FirstView Controller again?
I would really appreciate the help as it's horribly affecting some of my users.
An example of a Tinder like card view is shown!
The problem, from the sound of it, is not what happens when the app goes into the background — that would leave it in exactly the same state when it reactivates. The problem is what happens when the app goes into the background and quits. Your app is then relaunched from scratch, which is why you find yourself in the first view controller. What's upsetting you is the difference between the app's behavior in these two situations.
Apple provides a solution to this situation: UIViewController, along with the App Delegate, has methods permitting you to save and restore state. When the app goes into the background, the current configuration (what view controller's view is showing) is saved. That way, even when the app quits, when it relaunches it can get back to that configuration before it appears to the user. Thus, coming back from background-and-quit looks just like coming back from mere backgrounding.
For full details, see Apple's documentation. This is a good place to start:
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html

dismissViewControllerAnimated freezes with UIActivityViewController (facebook) on screen

I have encountered an issue where an app will freeze when dismissViewControllerAnimated is called.
It is called on the root viewcontroller (something I find suspicious), and happen when the when the user has chosen Facebook from a UIActivityController. It doesn't affect Twitter or Mail (the only other activities exposed). It also only happens on device.
So the flow is:
User initiates the UIActivityViewController Controller which shows various avenues to share content.
User chooses "facebook"
Post to facebook view is shown
(essentially) [[UIWindow rootViewController] dismissViewControllerAnimated] called, which freezes before returning.
I was curious either -
if anyone has seen this behaviour and has a solution, or at least
what are things that could cause dismissViewControllerAnimated to freeze.
I don't have an answer to the source of the freeze, however I was able to resolve the issue by dismissing the UIActivityController directly. Previously it was dismissed via the controller that presented it.
The best hypothesis I can come up with is the facebook controller (unlike the ones for mail or twitter) adjusts the relationship of the UIActivityController so that its presenting controller changes. After that it cannot be dismissed the way I was (note: my knowledge is iOS UI is pretty scant so I could be terribly wrong). I don't get why that would cause it to freeze though

back to previous controller before application enters background

i am developing an ios application that needs the user to login in order to get in to the system, if the user logged in and go to one of the view controllers in the application, then press home button. Now if he choose to open the application again (the application will enter forground), the application must redirect the user to the view controller he was viewing before he press the home button. Moreover, any data the user enters must be there.
Any Idea about how can I implement this in Xcode ?
Any help will be appreciated. Thanks :)
Save the viewController before app goes to background in the function applicationWillResignActive. And when app comes to foreground go to that viewController. If you have navigation based app, then call in applicationWillEnterForeground
[navigationController popToViewController:yourViewController];

iPhone UILocalNotification load specific view

I have my local notification working, but when I click View to come back to the app, in the app delegate I am trying to load a specific view, but it wont take. Is this possible or not? It always just comes back to the last view viewed.
When you tap "View" on the notification, it takes you back to your application, and your application shows whatever it was showing before (if it was backgrounded) or is launched.
If you need to show a particular UI in response to the notification, consider implementing the <UIApplicationDelegate> method -[<UIApplicationDelegate> application:didReceiveLocalNotification:]. In that method you can inspect the notification and transition to the appropriate interface.

Resources