Giter Club home page Giter Club logo

Comments (7)

afirst avatar afirst commented on September 3, 2024

We'll fix this in the next release. In the meantime, there is a workaround. First, add LPMessageTemplates.h/m to your project. These files are available if you download the SDK from Help > Setup. You'll need to initialize these templates by calling [LPMessageTemplates sharedTemplates] before calling [Leanplum start]. Then, in LPMessageTemplates.m, add this method:

+ (UIViewController *)visibleViewController
{
    UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController;
    if (root.presentedViewController) {
        return root.presentedViewController;
    }
    return root;
}

And replace both occurrences of:

[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alert animated:YES completion:nil];

with:

[[LPMessageTemplatesClass visibleViewController] presentViewController:alert animated:YES completion:nil];

from leanplum-ios-sdk.

akimdeliverydotcom avatar akimdeliverydotcom commented on September 3, 2024

Do you know when the next release will happen? We're trying to determine if we should put in this fix now or if we should wait. Also, when you say next release are you referring to a new SDK?

from leanplum-ios-sdk.

afirst avatar afirst commented on September 3, 2024

I would say within a week. The fix was tested in different scenarios, but if you have time to test it in your app, that would make sure we covered your specific use case.

from leanplum-ios-sdk.

akimdeliverydotcom avatar akimdeliverydotcom commented on September 3, 2024

Thanks for the update. We'll run tests in our app with the fix you recommended and will let you know how it turns out.

from leanplum-ios-sdk.

marcgug avatar marcgug commented on September 3, 2024

Hi @afirst,

I tried your workaround, and it almost works. However, sometimes we have multiple view controllers presented on the rootViewController, so the following works better for us for the visibleViewController method:

+ (UIViewController *)visibleViewController
{
    UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
    while (topController.presentedViewController) {
        topController = topController.presentedViewController;
    }
    return topController;
}

We are still testing to see if this works in all situations, but so far things are much improved.

from leanplum-ios-sdk.

afirst avatar afirst commented on September 3, 2024

Glad you were able to test it and thanks for the feedback! We'll incorporate that change.

from leanplum-ios-sdk.

alexisoyama avatar alexisoyama commented on September 3, 2024

Cleaning up the opened issues.
I just made a sample app and did not show any error.

from leanplum-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.