melieskubrick / CarbonKitSwift

CarbonKit is an iOS OpenSource libraries collection. CarbonKit includes: CarbonSwipeRefresh CarbonTabSwipeNavigation
MIT License
120 stars 33 forks source link

App Crashes if it is not rootview #2

Open samasubbaiah opened 8 years ago

samasubbaiah commented 8 years ago

I'm trying to implement this in my app, But in my app i had login page before the tab. when i'm trying to load the home page with the below code, This code in loginViewController, once the login success the below code will execute and navigates to home page,

let storyBoard = UIStoryboard(name: "Main", bundle: nil) let containerView = storyBoard.instantiateViewControllerWithIdentifier("homeView") dispatch_async(dispatch_get_main_queue()) { self.appDelegate.window?.rootViewController = containerView }

In homeViewController the app getting crash at the below lines,

carbonTabSwipeNavigation = CarbonTabSwipeNavigation(items: items as [AnyObject], delegate: self) carbonTabSwipeNavigation.insertIntoRootViewController(self)

I thought i'm setting homeviewcontroller as rootviewcontroller and again we are doing insertintorootviewcontroller in the above line, console giving the below error code.

fatal error: unexpectedly found nil while unwrapping an Optional value

so here it's crashing please, help me how to fix it.

yuvirajsinh commented 7 years ago

@samasubbaiah I am also facing same issue, to be more specific it's crashing in iOS 9.x anyone has solution for this?

Edit: I solved it I declared my CarbonTabSwipeNavigation instance as weak so after initialisation it was releasing instance