Skip to content

Commit b03aed7

Browse files
authored
Merge pull request #983 from OneSignal/fix/IAM_swiftui_crash
Guarantee that messageView is a subview of OSInAppMessageViewController
2 parents 458eedb + 914f5a1 commit b03aed7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

iOS_SDK/OneSignalSDK/Source/OSInAppMessageViewController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ Sets up the message view in its initial (hidden) position
280280
- (void)addConstraintsForMessage {
281281
[OneSignal onesignal_Log:ONE_S_LL_VERBOSE message:@"Setting up In-App Message Constraints"];
282282

283+
if (![self.view.subviews containsObject:self.messageView]) {
284+
[OneSignal onesignal_Log:ONE_S_LL_VERBOSE message:@"addConstraintsForMessage: messageView is not a subview of OSInAppMessageViewController"];
285+
[self.view addSubview:self.messageView];
286+
}
287+
283288
// Initialize the anchors that describe the edges of the view, such as the top, bottom, etc.
284289
NSLayoutAnchor *top = self.view.topAnchor,
285290
*bottom = self.view.bottomAnchor,

0 commit comments

Comments
 (0)