Giter Site home page Giter Site logo

在keyWindow的rootVC上通过presentViewController跳转的视图中,调用授权接口提示Warning: Attempt to present <UINavigationController about weibo_ios_sdk HOT 17 CLOSED

sinaweibosdk avatar sinaweibosdk commented on July 24, 2024 1
在keyWindow的rootVC上通过presentViewController跳转的视图中,调用授权接口提示Warning: Attempt to present from weibo_ios_sdk.

Comments (17)

joshuafeldman avatar joshuafeldman commented on July 24, 2024

I am experiencing this issue as well. It seems like if a modal is presenting authorization does not work

from weibo_ios_sdk.

Mfk759853063 avatar Mfk759853063 commented on July 24, 2024

我也遇到了从a present 到b,在b 调用授权接口,也是出现这个错误

from weibo_ios_sdk.

haitaoli avatar haitaoli commented on July 24, 2024

Same issue here. Version 2.5.1 works fine. The fix will look like this:

UIViewController * topViewController = window.rootViewController;

while (topViewController.presentingViewController)
topViewController = topViewController.presentingViewController;

from weibo_ios_sdk.

keeploading avatar keeploading commented on July 24, 2024

3.0.1版本里还有这个问题,能否赶紧解决这个问题,等着release。

from weibo_ios_sdk.

dannion avatar dannion commented on July 24, 2024

谢谢反馈,这个问题会在3.1.0版本中修复。3.1.0版本应该在3月份上旬前后发布。

from weibo_ios_sdk.

tmkjchen avatar tmkjchen commented on July 24, 2024

3.1.0何时发啊。我们也碰到同样的问题了。等着发布呢。谢谢。

from weibo_ios_sdk.

joshuafeldman avatar joshuafeldman commented on July 24, 2024

Any update on when this will be fixed?

from weibo_ios_sdk.

doggy avatar doggy commented on July 24, 2024

Have you guys forget to release new version in early march?

from weibo_ios_sdk.

joshuafeldman avatar joshuafeldman commented on July 24, 2024

Would love to see a fix for this since currently I am using method swizzling to fix the issue myself

from weibo_ios_sdk.

doggy avatar doggy commented on July 24, 2024

@joshuafeldman Which function name did you swizzling on?

from weibo_ios_sdk.

joshuafeldman avatar joshuafeldman commented on July 24, 2024

I made a category on UIViewController and swizzled the presentation method. My code is below although some of the methods are categories I have made on other classes but you get the idea. It isn't my favorite solution and hopefully it will be fixed so I can remove it.

@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]);
}

from weibo_ios_sdk.

doggy avatar doggy commented on July 24, 2024

Most appreciate @joshuafeldman

from weibo_ios_sdk.

manymingge avatar manymingge commented on July 24, 2024

still not updated?

from weibo_ios_sdk.

phnessu4 avatar phnessu4 commented on July 24, 2024

微博果然还是黄了,作为一个前微博员工,对这个更新速度和效率,感到一点也不意外。。。
自己动手,丰衣足食。

from weibo_ios_sdk.

SeanChense avatar SeanChense commented on July 24, 2024

same with @joshuafeldman .

Presented to a, then use sdk to request token but failed.

from weibo_ios_sdk.

SeanChense avatar SeanChense commented on July 24, 2024

@sinaweibosdk This issue should close.

from weibo_ios_sdk.

wujianbotju avatar wujianbotju commented on July 24, 2024

作为一个前微博员工,感到丢脸,为什么这个bug到现在都还没有修复,我去...

from weibo_ios_sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.