New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在keyWindow的rootVC上通过presentViewController跳转的视图中,调用授权接口提示Warning: Attempt to present <UINavigationController #52
Comments
I am experiencing this issue as well. It seems like if a modal is presenting authorization does not work |
我也遇到了从a present 到b,在b 调用授权接口,也是出现这个错误 |
Same issue here. Version 2.5.1 works fine. The fix will look like this: UIViewController * topViewController = window.rootViewController; while (topViewController.presentingViewController) |
3.0.1版本里还有这个问题,能否赶紧解决这个问题,等着release。 |
谢谢反馈,这个问题会在3.1.0版本中修复。3.1.0版本应该在3月份上旬前后发布。 |
3.1.0何时发啊。我们也碰到同样的问题了。等着发布呢。谢谢。 |
Any update on when this will be fixed? |
Have you guys forget to release new version in early march? |
Would love to see a fix for this since currently I am using method swizzling to fix the issue myself |
@joshuafeldman Which function name did you swizzling on? |
I made a category on @implementation UIViewController (FGSinaWeiboPresenterFix)
#pragma mark - NSObject Class Methods
+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
/* strongify:ignore */
[self swizzleInstanceMethod:@selector(presentViewController:animated:completion:)
toMethod:@selector(_weibo_fix_presentViewController:animated:completion:)];
});
}
#pragma mark - Private Methods
- (void)_weibo_fix_presentViewController:(UIViewController *)viewControllerToPresent
animated:(BOOL)flag
completion:(void (^)(void))completion
{
// determine if the class name prefix is for the weibo SDK and be safe to make sure the length
NSString * weiboSDKPrefix = @"WBSDK";
NSString * className = [self classNameFromViewControllerToPresent:viewControllerToPresent];
if ( className.length >= weiboSDKPrefix.length ) {
NSString * prefix = [[className substringWithRange:NSMakeRange(0, weiboSDKPrefix.length)] uppercaseString];
if ( [prefix isEqualToString:weiboSDKPrefix] ) {
[[UIViewController topViewController] _weibo_fix_presentViewController:viewControllerToPresent
animated:flag
completion:completion];
return;
}
}
// call the original method
[self _weibo_fix_presentViewController:viewControllerToPresent animated:flag completion:completion];
}
- (NSString *)classNameFromViewControllerToPresent:(UIViewController *)viewController
{
if ( [viewController isKindOfClass:[UINavigationController class]] ) {
return [self classNameFromViewControllerToPresent:((UINavigationController *)viewController).topViewController];
}
return NSStringFromClass([viewController class]);
} |
Most appreciate @joshuafeldman |
still not updated? |
微博果然还是黄了,作为一个前微博员工,对这个更新速度和效率,感到一点也不意外。。。 |
same with @joshuafeldman . Presented to a, then use sdk to request token but failed. |
@sinaweibosdk This issue should close. |
作为一个前微博员工,感到丢脸,为什么这个bug到现在都还没有修复,我去... |
错误场景:
A(视图控制器)通过presentViewController跳转到了B(视图控制器)中,然后在B的按钮事件中调用了授权接口。无法实现跳转,并且出现的错误提示如下:
Warning: Attempt to present <UINavigationController: 0xa8ad560> on <ViewController: 0xa53afb0> whose view is not in the window hierarchy!
自己猜测原因大概是微博的sdk中,先通过keyWindow的rootVC的继承关系获得“根视图”。再通过presentViewController跳转到授权页面。
大概是类似这样吧:
[[SomeInstance getRootViewController] presentViewController:authorVC animated:YES completion:nil];
请相关技术人员帮忙看下:
这边的获取跳转到授权页面的源视图的方法即getRootViewController,是否应该做相应的修改。
或者说,如果我已经通过presentViewController跳转到了自己的某个视图控制器中,如何在这个控制器中调用授权接口吧。
The text was updated successfully, but these errors were encountered: