OceanLabs / iOS-Print-SDK

iOS Print SDK. Easily add print on demand functionality to your app within minutes! Print Postcards, Magnets, Photo Prints, Posters, Stickers, T-Shirts, PhotoBooks, etc.
https://www.kite.ly
111 stars 33 forks source link

Fixed “push a nil view controller” error when checkout printOrder item. #296

Closed yyjim closed 6 years ago

yyjim commented 6 years ago

Context

We found a bug that user can’t checkout the item in the review page. Clicking Next button has no effect. It just grayed out.

We also see this error log in debug console

Application tried to push a nil view controller on target 
<OLNavigationController: 0x7f8901025e00>.
screen shot 2018-01-29 at 11 51 45 am

Description

I found that the OLCaseViewController was not initialized from storyboard. (see OLKiteViewController.m#L264), so the self.storybard is nil which cause this code return nil controller.

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"OLProductOverviewViewController"];

Solution

Get storyboard by [OLUserSession currentSession].kiteVc.storyboard when self.storyboard is nil.

I refer to OLSingleProductReviewViewController.m#L337