Comments (7)
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.
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.
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.
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.
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.
Glad you were able to test it and thanks for the feedback! We'll incorporate that change.
from leanplum-ios-sdk.
Cleaning up the opened issues.
I just made a sample app and did not show any error.
from leanplum-ios-sdk.
Related Issues (20)
- Leanplum utilizes bitcode by default and causes errors to occur for other non bitcode pods HOT 4
- (Cocoapods) Unable to run to device using Leanplum 2.4.0
- Crash on updating values for LP Variables w/ iOS SDK 2.4.0
- __leanplum.sqlite console error?
- Deprecation warnings when building with SPM HOT 2
- Ambiguity between the module name and a class in the module emits errors when using the module
- XCode14 property availability compilation fail HOT 4
- Crash in [LPVarCache registerActionDefinition:ofKind:withArguments:andOptions:] HOT 5
- Nothing happen when trying to interact with underlaying view controller when LPWebInterstitial banner is presented HOT 4
- Broken SPM support HOT 3
- LPWebInterstitial banner doesn't display HOT 14
- still looks good HOT 1
- Your dependency CleverTap is using old version of SDWebImage HOT 5
- Button Action of InAppMessages deeplink not working HOT 1
- Storyboard error when launching a rich interstitial HOT 3
- Runtime issue after Leanplum.start() HOT 3
- App Startup Crash [LPDatabase runQuery:bindObjects:]
- Apple Privacy issues HOT 3
- 6.4.0 and 6.4.1 fail to build with error `__swift_FORCE_LOAD_$_swiftXPC_$_Leanplum in Leanplum[arm64][75](MigrationManager+Constants.o)` HOT 1
- 6.4.0 and 6.4.1 fail to build with error __swift_FORCE_LOAD_$_swiftXPC_$_Leanplum in Leanplum[arm64][75](MigrationManager+Constants.o) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leanplum-ios-sdk.