question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom url scheme redirect does not work with cordova platform ios @5.0.0

See original GitHub issue

Bug Report

Problem

Using ionic cordova platform ios @5.0.0 Url scheme redirect for OAuth log in, does not work, when app is accessed from within another app. This is working with cordova ios @4.5.4

What is expected to happen?

Installing my app from Test Flight, clicking the ‘open’ button inside Test Flight, opens the app and presents a login view. Clicking ‘log in’ redirects the app using SafariViewBrowser plugin to an OAuth login. Entering credentials, the user are logged in and redirected back to the app, using CustomUrlScheme plugin.

What does actually happen?

After entering credentials the view goes blank and does not return to the app

Information

This might be a plugin issue with SafariViewBrowser or CutstomUrlScheme, however I have tried to reinstall these plugins with different release versions, without luck. the issue is not present if I use cordova ios @4.5.4

Version information

`ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.2.3
Cordova Platforms  : android 7.0.0 browser 5.0.4 ios 5.0.0
Ionic Framework    : ionic-angular 3.9.4

System:

ios-deploy : 1.9.2 
ios-sim    : 6.1.3 
Node       : v8.11.1
npm        : 5.6.0 
OS         : macOS
Xcode      : Xcode 10.2 Build version 10E125  `

package.json

{ "name": "printix-app-user", "author": "Printix", "homepage": "http://iprintix.net/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build", "ionic:watch": "ionic-app-scripts watch", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/common": "5.2.6", "@angular/compiler": "5.2.6", "@angular/compiler-cli": "5.2.6", "@angular/core": "5.2.6", "@angular/forms": "5.2.6", "@angular/platform-browser": "5.2.6", "@angular/platform-browser-dynamic": "5.2.6", "@ionic-native/core": "4.11.0", "@ionic-native/device": "4.11.0", "@ionic-native/in-app-browser": "4.11.0", "@ionic-native/keyboard": "4.11.0", "@ionic-native/network": "4.11.0", "@ionic-native/qr-scanner": "4.11.0", "@ionic-native/safari-view-controller": "^4.11.0", "@ionic-native/screen-orientation": "4.11.0", "@ionic-native/splash-screen": "4.11.0", "@ionic-native/sqlite": "4.11.0", "@ionic-native/status-bar": "4.11.0", "@ionic-native/vibration": "4.11.0", "@ionic/storage": "^2.2.0", "@ngx-translate/core": "9.1.1", "@ngx-translate/http-loader": "2.0.1", "@types/lodash": "^4.14.109", "angular-2-local-storage": "1.0.1", "angular2-moment": "^1.9.0", "bootstrap-sass": "^3.3.7", "chart.js": "2.7.1", "cordova-android": "7.0.0", "cordova-browser": "5.0.4", "cordova-ios": "4.5.5", "cordova-plugin-add-swift-support": "^2.0.2", "cordova-plugin-customurlscheme": "^4.4.0", "cordova-plugin-inappbrowser": "^3.0.0", "cordova-plugin-network-information": "^2.0.1", "cordova-plugin-qrscanner": "^2.6.2", "cordova-plugin-safariviewcontroller": "^1.5.4", "cordova-plugin-screen-orientation": "^3.0.1", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-vibration": "^3.1.0", "cordova-plugin-whitelist": "^1.3.3", "cordova-sqlite-storage": "^3.2.0", "es6-promise-plugin": "^4.2.2", "fast-json-patch": "2.0.6", "flag-icon-css": "3.0.0", "immutable": "^3.8.2", "ionic-angular": "3.9.4", "ionic-plugin-deeplinks": "^1.0.17", "ionic-plugin-keyboard": "^2.2.1", "ionicons": "3.0.0", "ios-sim": "^6.1.2", "list": "^2.0.13", "lodash": "^4.17.10", "ngx-order-pipe": "^2.0.1", "rxjs": "5.5.6", "zone.js": "0.8.20" }, "devDependencies": { "@angular/cli": "^7.3.0", "@ionic/app-scripts": "3.2.3", "postcss": "6.0.14", "typescript": "^2.7.2" }, "cordova": { "platforms": [ "browser", "android", "ios" ], "plugins": { "cordova-plugin-network-information": {}, "cordova-plugin-statusbar": {}, "ionic-plugin-keyboard": {}, "cordova-plugin-screen-orientation": {}, "cordova-plugin-vibration": {}, "cordova-plugin-whitelist": {}, "cordova-plugin-add-swift-support": {}, "cordova-plugin-qrscanner": {}, "cordova-plugin-splashscreen": {}, "cordova-sqlite-storage": {}, "cordova-plugin-inappbrowser": {}, "cordova-plugin-customurlscheme": { "URL_SCHEME": "printixapp", "ANDROID_SCHEME": " ", "ANDROID_HOST": " ", "ANDROID_PATHPREFIX": "/" }, "cordova-plugin-safariviewcontroller": {} } } }

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zhangjinglecommented, Mar 4, 2020

cordova-ios, CDVAppDelegate.m post openurl notifiycaiton before observer(CDVHandleOpenURL.m) register notification

fix: in AppDelegate.m

#import “AppDelegate.h” #import “MainViewController.h”

@interface AppDelegate() @property (nonatomic) BOOL pageDidLoad; @property (nonatomic, strong) NSURL * openURL; @end

@implementation AppDelegate

  • (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { // … your code [self fixOpenURL]; return YES; }

-(void)fixOpenURL { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationPageDidLoad:) name:CDVPageDidLoadNotification object:nil]; }

-(void)applicationPageDidLoad:(NSNotification*)notification { self.pageDidLoad = YES; [self postMessageForOpenURL]; }

  • (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options { self.openURL = url; [self postMessageForOpenURL]; return YES; }

-(void)postMessageForOpenURL { if (self.openURL && self.pageDidLoad) { [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:self.openURL]]; } }

@end

1reaction
gambarlecommented, Apr 16, 2019

@Durzan666 Yes there is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iPhone - handleOpenURL Custom-URL-scheme plugin
It's working perfectly on Android but for iOS it does not redirect back to the application. It stays on the browser page and...
Read more >
cordova-plugin-customurlscheme - npm
This Apache Cordova issue causes problems with Cordova-iOS 3.7.0: the handleOpenURL function is not invoked upon cold start.
Read more >
Cordova iOS 5.1.0 Released!
It seems that this kind of problem is related to an incorrect installation of the Cordova platform. Alê. • 2 years ago. The...
Read more >
Getting an unknown URL scheme error in Ionic 2
If you haven't done that part correctly then no application is available to handle such custom URL scheme which would ultimately end with...
Read more >
Redirecting to Custom URL Scheme in iOS 13 Safari
However, it is broken in iOS 13 Safari. The server attempts to redirect to the custom URL scheme link, but our app is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found