John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

SWRevealViewController on iOS 9 not working #443

Open erhkeoprhjospdg opened 9 years ago

erhkeoprhjospdg commented 9 years ago

Hi,

I just tried to use this library in iOS 9:

  1. Create project template Master-Detail Application.
  2. In new Xcode should be also UISplitView Controller as initial controller.
  3. I added RevealView Controller with UITableView Controller to the storyboard

When I drag master view it works good. When I push right button to reveal rear view it does not work. In iPad application it doesn't work at all.

How can I fix this issues? Can you please help me?

Thanks, Ruslan

sfbayman commented 9 years ago

I have also tried to integrate this and no luck. Getting stuck in the loadStoryboardControllers method block. //Try each segue separately so it doesn't break prematurely if either Rear or Right views are not used. @try { [self performSegueWithIdentifier:SWSegueRearIdentifier sender:nil]; // stuck here } @catch(NSException *exception) {}

Softwares: iOS 9 and Xcode 7 beta 3

Need help.

Stun-nutS commented 9 years ago

Hi,

Same issue for for me. On view controllers, self.revealViewController return "nil". So I can't call the menu with any button or gesture.

Thanks, Stun

BaranBerk commented 9 years ago

I have updated iPhone 5 to iOS 9 and then over test flight send the app ( as internal tester). It works fine

rycardo commented 9 years ago

BaranBerk, Have you compiled the project in Xcode 7 for iOS 9? Or only updated your device to iOS 9 and tried? Using my app compiled in Xcode 6.x for iOS 8.x, on an iOS 9 device, yes, everything works as intended. However, If I compile the project in Xcode 7 beta 4 for iOS 9 beta 4, then my rear view controller will not display on that same device running iOS 9.

BaranBerk commented 9 years ago

I havent't updated xcode it is still 6.x. I have just updated my device to iOS 9 and tried.

Stun-nutS commented 9 years ago

In fact, in iOS 9 the property "parent" of navigation controllers created by the SW segue is nil, so in @implementation UIViewController(SWRevealViewController), no SWRevealViewController are found and nothing else can't work. I'm looking for a workaround to retrieve the instantiated SWRevealViewController. If it's an ARC upgrade the controller is probably deleted...

rycardo commented 9 years ago

I was able to get it to work, but I'm not sure why. I deleted all the connections between my existing classes and view controllers; created new view controllers in the Storyboard; created new source files for the classes; copied all the code from my original class files (.h and .m); connected the new storyboard outlets to the new files. Now SWRevealViewController works in iOS 9 using Xcode 7. It was quite a bit of tedious effort to do, but it worked for me. YMMV Rycardo

ghost commented 9 years ago

Anybody have any idea how to make this work on xCode 6 and iOS9?

joshjack commented 9 years ago

Any updates? iOS 9 is officially launching next week and iOS users tend to update pretty quickly

joshjack commented 9 years ago

I have just updated to XCode 7 today, but I'm still using iOS 8.4 on my devices. This issue popped up immediately. The first view to load works fine with SWReveal, but when I segue to my next view the self.revealviewcontroller call returns nil everytime.

I even tried passing a global reference to the revealviewcontroller and none of the calls to "rightrevealToggle" work anymore (same for left). No exceptions or errors, just nothing.

sebastienALU commented 9 years ago

I had a similar issue. To solve it, I have deleted from my UITableView the UITableViewCell triggering the segue from the SWReveal in my storyboard. Next I have created again the UITableViewCell and the Segue in my storyboard and t's working again.

joshjack commented 9 years ago

My front controller was a navigation based controller. I seem to have fixed the issue in Xcode 7 by changing the segues from normal push to SWRevealControllerSeguePUSH. In some cases (not sure why the difference) I also have to use a global reference to the SWRevealController as the parent can be nil.

pontus-andersson commented 9 years ago

I managed to do a work around on Xcode 7 by initiating the SWRevealViewController by code using: - (id)initWithRearViewController:(UIViewController *)rearViewController frontViewController:(UIViewController *)frontViewController instead of storyboard segues.

Stun-nutS commented 9 years ago

@pontus-andersson : could you paste a sample of your workaround please?

pontus-andersson commented 9 years ago

@Stun-nutS : I do this in the AppDelegate after my synchronization handler is completed. Hope it helps.

IPMenuTableViewController *menuTableViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"IPMenuTableViewController"]); UINavigationController *messagesNavigationController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"IPMessagesNavigationController"]; SWRevealViewController *rootViewController = [[SWRevealViewController alloc] initWithRearViewController:menuTableViewController frontViewController:messagesNavigationController]; self.window.rootViewController = rootViewController;

ksuh999 commented 9 years ago

So I faced the same problem - menu would not appear when the menu button was tapped or from swiping.

Turns out it was because I used the performSegueWithIdentifier method in the controller displayed from the "sw_front" segue (it was a login view, but if the person was already logged in, I took them to another view that was more useful).

Calling performSegueWithIdentifier meant that the reference to the SWRevealController instance was lost in the next view - hence self.revealViewController() was always nil.

So basically you can never use performSegueWithIdentifier if you want the menu to work. If you want to show a view progammatically, do this:

let view = self.storyboard!.instantiateViewControllerWithIdentifier("<the Storyboard ID of the navigation controller>") as! UINavigationController

self.revealViewController().pushFrontViewController(view, animated: <true or false>)

Note that you have to push the navigation controller for the view you want to display, otherwise you won't see the navigation on the destination view.

This will give you the proper reference to the SWRevealController on the destination view.

joshjack commented 9 years ago

Actually, I'm still having pretty good luck using performSegueWithIdentifier as long as the segue class is set to SWRevealViewControllerSeguePushController in the Storyboard.

rauluranga commented 8 years ago

@ksuh999 i'm having the same problem and discovered that if i delete the performSegueWithIdentifier method, the self.revealViewController() works again does not return nil anymore. so, is still the solution to manually call self.revealViewController().pushFrontViewController??