Reputation: 71
I integrated OneSignal to my iOS-App (WKWebview). But its automatically opening another webview window. I just want to load the given URL into my Webview, not another one. Universal Links/Deep Linking is also integrated.
I read that I can give "additional data" to every send notification, but I do not really know how I can catch that inside my AppDelegate (or somewhere else).
I added OneSignal this way: https://documentation.onesignal.com/docs/ios-sdk-setup
Upvotes: 4
Views: 855
Reputation: 904
You will want to do this in the AppDelegate.m
The payload will look like this
// (Optional) - Create block that will fire when a notification is tapped on.
id notificationOpenedBlock = ^(OSNotificationOpenedResult *result) {
OSNotificationPayload* payload = result.notification.payload;
NSString* messageTitle = @"OneSignal Example";
NSString* fullMessage = [payload.body copy];
if (payload.additionalData) {
if (payload.additionalData[@"OpenURL"])
redVC.receivedUrl = [NSURL URLWithString:(NSString *)payload.additionalData[@"OpenURL"]];
Upvotes: 1