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

Black screen appears sometimes #323

Open Crocotronic opened 10 years ago

Crocotronic commented 10 years ago

Hello, It seems that I'm the only one having issues like this? As the title already says I sometimes get a black screen on my iPhone 5 (iOS 7). Mostly at startup when panning from left to right. I set bounceBackOnOverdraw and bounceBackOnLeftOverdraw to false and a rearViewRevealDisplacement of 100. I also download some data from the internet at startup, but I think there shouldn't be performance problems. Do you have any experiences with this issue?

Best regards Benny

SalehAlbuga commented 10 years ago

I'm having the same issue, black screen appears then disappears quickly

balkarov commented 10 years ago

'm having the same issue too, but I do not know how to fix it

brianhmayo commented 10 years ago

Yeah, +1 this. I see it too and would like to understand how to get it cleared up. I see it when the device is in landscape mode. I run with two RevealControllers. I can reproduce it every time when I am swiping the child most front view controller to the left. I will see a black bar on the right side for just a moment. Cannot fully tell how wide it is.

TiagoLira commented 10 years ago

I went back to using version 2.2 (with Cocoapods) and it solved the black screen problem for me.

John-Lluch commented 10 years ago

This seems to be a recurrent issue, but I can't reproduce it and I never saw it. Please, can someone post an example -ideally derived from one the existing ones- so I can reproduce it? You are all providing very little information on the particular conditions or code that produces this. Thanks.

SalehAlbuga commented 10 years ago

It appears randomly, I'm finding a way to reproduce it. But when it appears I get a long log with ": CGContextRestoreGState: invalid context 0x0 his is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update." errors

John-Lluch commented 10 years ago

Ok, but how is this related with the SWRevealViewController?. The class does not use CGContexts as it is not drawing anything.

SalehAlbuga commented 10 years ago

It only happens when I slide the left menu the becomes black & then normal again & I get that in the log. The app I'm making doesn't draw anything either

John-Lluch commented 10 years ago

I am just trying to guess what could produce this, but so far I am lost because as said I can't reproduce it.

Does setting toggleAnimationType to SWRevealToggleAnimationTypeEaseOut or to SWRevealToggleAnimationTypeSpring make any difference?

Also, please can you try to replace this

    if ( fromViewController )
    {
        [UIView transitionFromView: 

by this

    if ( YES ||  fromViewController )
    {
        [UIView transitionFromView:

in

- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext

to see if that makes any change?

Thanks.

wizdaz2 commented 10 years ago

Hi, I have this issue as well.

It happens only with Spring animation and specific duration time. In my case with duration = 0.061204 it is reproducible 100% of time.

Might be an iOS bug. Hope it will help you with fixing it.

ilant commented 10 years ago

have seen it many times, when the frontView has heavy graphics content. In previous version of swrevealcontroller, problem didn't existed

savetree commented 9 years ago

same problem here...

paulsturgess commented 9 years ago

Yep also happens for me. Very intermittent. Haven't been able to identify a way to reproduce it on demand.

micnguyen commented 9 years ago

Also can confirm I am getting the black screen on 2.3.0. It happens literally randomly and I can't seem to reproduce it at all.

mervinlabs commented 9 years ago

I have the same problem. I can't figure out what triggers it. I've tried reverting to 2.2.0 but it happens with that version also. It's really odd - I can run my app 10 times and not see it, and then the next time I'll see it, just once and not again for that session. Will keep trying to see if I can get something reproducible.

PerfectAchiever commented 9 years ago

I have this error when importing SWRevealViewController 1 in iOS 8 says that method 'target transform' in protocol 'UiViewControllerContextTransitioning' not implemented do anyone know how to solve it I tried but no luck

carloperez commented 9 years ago

Confirmed I'm seeing this issue as well. Will also hunt for repro steps.

PerfectAchiever commented 9 years ago

Do you think if isubmit the app to itunes for approval will they disapprove the app as of this error the app works fine

carloperez commented 9 years ago

So I made the change to

if ( YES || fromViewController ) { [UIView transitionFromView:

Initially it seemed like this helped but once I got to playing in the app long enough the issue happened again.

I then set the toggle type to SWRevealToggleAnimationTypeSpring and currently I am not seeing the problem.

Will report back again after a day of this. Is anyone else seeing a difference with the above changes?

PerfectAchiever commented 9 years ago

Can you explain more

carloperez commented 9 years ago

Do a search for that line in your project - you'll find it in the SWRevealController code - and then replace the code.

For the flag, just set it the same way you set other properties when you create an instance of SWRevealController.

PerfectAchiever commented 9 years ago

Hi i'm new in iOS programming and i'm struggling doing this could you give me more hints will be appreciate it so much

grabbou commented 9 years ago

I am getting that black screen randomly every 30/40 slides (sometimes less frequently, sometimes more frequently). @John-Lluch as my app is in early stage, can I send it to you over an email so you can take a look at it? /only your library has been added + few other controllers to test the whole logic/

holahyunsik commented 9 years ago

For me, this happens to me when making FrontView come out from the left(out of the screen, on the left side) to the right like a pop-out menu.

Created my own FrontView VC then implemented UIView in there, positioned the view on the left then when either touched the button or swiped, it comes out to the right(over RearView).

All works well except RearView stays black. Another thing is that when my FrontView is still out of the sight(on the left), interaction on RearView doesn't work but instead when FrontView is out(over RearView), RearView's interaction works ON FrontView having FrontView on it so I'm guessing even though I've implemented and re-positioned my own FrontView, the original FrontView's still there. I just don't know how to move it as my own FrontView moves or sync them.

Help?! captura de pantalla 2015-01-12 a las 14 51 49

leszek-s commented 9 years ago

I've also notice this problem with black screen appearing randomly. I noticed it on both iPhone 5 iOS 8.1 simulator and iPhone 5 iOS 8.1 device. It appears that this problem exists only when I use built in panGesture and I slide my finger quite fast to show the menu.

paulsturgess commented 9 years ago

@carloperez did your solution fix the problem in the end?

What change did you make to the if ( YES || fromViewController )

John-Lluch commented 9 years ago

Hi all,

Have you tried to set 'toggleAnimationType' to SWRevealToggleAnimationTypeEaseOut ?. I think this is an Apple bug when using spring animations.

Thanks

leszek-s commented 9 years ago

This bug exists in v2.3.0 and also in v2.2.0 however it looks like it does not exist in v2.1.0. I've switched to v2.1.0 few days ago and since that day I haven't seen the black screen and everything works as expected. For everyone who is experiencing this problem I can recommend switching back to v2.1.0.

carloperez commented 9 years ago

Hi @paulsturgess: No, that didn't do the trick for me. There's a post from @John-Lluch on September 16th that describes it. I had actually thought I might just forego the 'tray' effect and head for more traditional pastures but it seems there's more interest in finding a fix here now. Unfortunately I've got no new data. : /

@John-Lluch I had changed the toggleAnimationType to Spring before as instructed and I can verify the bug still showed. I will try with EaseOut today.

@fins Just wondering how reliably were you triggering the bug in 2.3.0 and 2.2.0? Sometimes I wouldn't trigger it in a day so I would think it was gone.

leszek-s commented 9 years ago

@carloperez in v2.3.0 and v2.2.0 I was able to reproduce this bug every time I runned the app in 20-40 attempts (pan gestures). Since I switched to 2.1.0 few days ago I was not able to reproduce it doing the same pan gesture test and I've tried a lot so it seems that it is working fine in this version.

leszek-s commented 9 years ago

I've just downloaded https://github.com/John-Lluch/SWRevealViewController/archive/v2.3.0.zip and I was able to reproduce black screen bug on example project RevealControllerExample on iPhone 5 (8.1) simulator few times and I've recorded a video with it. Black screen is visible at 1:17 here: https://www.youtube.com/watch?v=kiDCeQLyRqk I hope this will help finding the problem.

schayes04 commented 9 years ago

@John-Lluch switching to SWRevealToggleAnimationTypeEaseOut seems to have fixed it for me. Thanks!

carloperez commented 9 years ago

Thanks for all the info, @fins. @John-Lluch from the notes the 2.3 notes state:

"This version fixes an old bug that caused an incorrect initialization of the class on particular scenarios. The old RevealControllerStoryboardExample has been removed from the repo as it was deprecated, please use the newest RevealControllerStoryboardExample2 instead."

Could you comment a bit more on the frequency/severity of this bug? I'd like to keep the spring animation and will downgrade to 2.1.0 depending on the dangers...

Crocotronic commented 9 years ago

I downgraded to 2.1.0 too and everything works perfect except the "swipe to delete" function of the UITableViewController

grabbou commented 9 years ago

@schayes04 will try and let you know if it works for me as well. Black screen does not appear when pan gesture is disabled. By tapping on the icons and opening up drawers programatically, I can't make the black screen flash appear.

gintechsystems commented 9 years ago

SWRevealToggleAnimationTypeEaseOut also fixed it for me, so whether it is a Apple bug or the code in sw itself, hoping we can find a workaround. I would rather the spring animation myself.

bouchtaoui-dev commented 9 years ago

My configuration: XCode 6.1.1 iOS SDK 8.1 Deployment target 8.1 Test device: iPhone 5 iOS: 8.1.3

Hello guys, I tried by setting toggle type to SWRevealToggleAnimationTypeEaseOut, but sadly enough this doesn't work for me. SWRevealViewController works when I made a simple test app to test whether it's working or not. But when I wanted to include it into my real app I get a black screen as my rear view. In my case sw_front connects to a UITabBarController object. I'll try an older version, but it would be great if this bug get fixed, it's really a nice must-have project.

Note: What's weird in my situation, I also see an empty tabbar on the bottom of the black screen. I haven't studied the source code of SWRevealViewController well, but I can imagine it doesn't work well with a Navigation Controller or a TabBar Controller.

gintechsystems commented 9 years ago

I have tried testing it again and it still seems to be working for me, with the latest release of iOS and SWRevealViewController. I do not use the tabBar controller though, only the navigation controller with paging. I would try an older project unless you really need to stay with the new one, do you also see the black screen when trying to use spring?

bouchtaoui-dev commented 9 years ago

@gintechsystems it just doesn't work. I replaced TabBar controller with a ViewController that holds a pageviewcontroller, with no result.

What do you mean by "spring"? Anyway I've set SWRevealToggleAnimationTypeEaseOut in the SWRevealViewController, I've set it when initializing the gesture action in my ViewController, all with no result. I don't think it has to do with XCode or iOS version. Because I've tested again with just one simple ViewController as the front view and a Viewcontroller as the rear view and it worked. I just can't think of any logic assumption what 's going on here.

gintechsystems commented 9 years ago

I mean the SWRevealToggleAnimationTypeSpring option instead of EaseOut. Nah, I doubt it is the Xcode, but possibly iOS or the latest release of SWRevealViewController. So it works without a tabBar?

leszek-s commented 9 years ago

It does not work with or without a tab bar. I do not have a tab bar in my application but I do have a navigation controller. In my case latest version v2.3.0 and v2.2.0 was not working. I was getting black screen quite often. Now it is about one month since I switched to v2.1.0 and since that time I did not see the black screen. Everything works properly with v2.1.0.

gintechsystems commented 9 years ago

I might have to check out v2.1.0, as the recent changes do not affect me. Are you saying it does not work WITH or WITHOUT the tab bar, your first sentence kinda does not make sense.

leszek-s commented 9 years ago

I meant that it does not work with a tab bar and it does not work without a tab bar. It does not matter if you are using a tab bar or not. Newest version 2.3.0 just does not work properly.

gintechsystems commented 9 years ago

I disagree, I do not have a tab bar in 2.3.0 and it works perfect, all I have is navigation controller. The only issue I have is I cannot use the spring animation.

bouchtaoui-dev commented 9 years ago

In my "big" project I changed SWRevealViewController to 2.1.0 and even set it as the initial view controller and added two dummy view controllers (one for the side menu and one for the content) just to test it. Even than I get the black screen with in the bottom a gray bar. So I just gave up, it could be the target version, the build compiler or whatever. Anyway, thnx.

gintechsystems commented 9 years ago

You should upload your example project, I (or someone in this thread) can check it out and see if we notice any issues. Just a suggestion. Otherwise, good luck with it :)

bouchtaoui-dev commented 9 years ago

@gintechsystems thnx for your offer to help me, I really appreciate it. Because of lack of time, I searched an alternative solution and I came across RESideMenu that works for me. But I like SWReveal more because of the simplicity. I hope to have some time free to create an example project where the black screen problem occurs and share it with you to analyze the problem. Thank you.

emitelma commented 9 years ago

Had the same issue. Setting revealAnimationType = SWRevealToggleAnimationTypeEaseOut fixes it but I liked SWRevealToggleAnimationTypeSpring better.

yzlai commented 9 years ago

Hey guys, I'm setting rearViewRevealWidth = 305. The following code patch can ALWAYS reproduce it. I'm not familiar with animation. Hope @John-Lluch or somebody can find a solution soon!

--- a/Pods/SWRevealViewController/SWRevealViewController/SWRevealViewController.m
+++ b/Pods/SWRevealViewController/SWRevealViewController/SWRevealViewController.m
@@ -1412,7 +1412,8 @@ const int FrontViewPositionNone = 0xff;
         }
         else
         {
-            [UIView animateWithDuration:_toggleAnimationDuration delay:0.0 usingSpringWithDamping:_springDampingRatio initialSpringVelocity:1/duration
+            CGFloat blackScreenVelocity = 16.5;
+            [UIView animateWithDuration:_toggleAnimationDuration delay:0.0 usingSpringWithDamping:_springDampingRatio initialSpringVelocity:blackScreenVelocity
             options:0 animations:animations completion:completion];
         }
     }

Set blackScreenVelocity between 16.3 and 16.7, with default _toggleAnimationDuration = 0.3 can reproduce this issue.

ohcrider commented 9 years ago

It seems still an same problem.xcode version:Version 6.4 (6E35b),iOS:8.4.1