Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

The plugin doesn't work on iOS #88

Open
meysam-mahmoodi opened this issue Jun 19, 2019 · 26 comments
Open

The plugin doesn't work on iOS #88

meysam-mahmoodi opened this issue Jun 19, 2019 · 26 comments
Assignees
Labels

Comments

@meysam-mahmoodi
Copy link

Hello

What did you do?

I installed the plugin successfully then created my own URL Scheme. When I type my own URL Scheme in a browser, it goes to the app correctly but handleOpenURL method is not called and I can't get anything.

What did you expect to happen?

I expected, handleOpenURL ran and I can get the App URL in App Component.

What happened instead?

The method,handleOpenURL, was not raised.

Your Environment

NativeScript version: 5.4.0
Java version:
NodeJS and NPM version: NodeJS: v8.9.1
Platform(s) running: iPhone 6s iOS 12.3.1

Demo Project

N/A

app.component

import { Component, OnInit } from "@angular/core";
import { NavigationEnd, Router } from "@angular/router";
import { AppURL, handleOpenURL } from "nativescript-urlhandler";

@Component({
    moduleId: module.id,
    selector: "ns-app",
    templateUrl: "app.component.html",
})

export class AppComponent implements OnInit {
    constructor(
        private router: Router,
    ) {}

    public ngOnInit() {
        handleOpenURL((appURL: AppURL) => {
            console.log("Got the following appURL", appURL);
        });
    }
 }
@hypery2k
Copy link
Owner

which version of the plugin you'r using?

@hypery2k hypery2k self-assigned this Jun 19, 2019
@hypery2k hypery2k added the bug label Jun 19, 2019
@hypery2k
Copy link
Owner

can you try version 1.3.0?

@meysam-mahmoodi
Copy link
Author

Thank you for your answer.
I tried that with version 1.3.0. It doesn't work. After a few hours, I still could not understand what the problem is.

@blaur
Copy link

blaur commented Jul 12, 2019

@hypery2k I'm having the same problem on most recent version of Nativescript.

@blaur
Copy link

blaur commented Jul 13, 2019

Don't know if this helps you but my package.json looks like this. All working on android but on iOS it just does not do anything:

 "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/http": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "nativescript-angular": "~7.2.0",
    "nativescript-mobilepay": "file:../src",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~6.3.0",
    "tns-core-modules": "~5.3.0",
    "zone.js": "~0.8.26",
     "nativescript-urlhandler": "^1.3.0"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~7.2.0",
    "@nativescript/schematics": "~0.5.0",
    "@ngtools/webpack": "~7.2.0",
    "nativescript-dev-typescript": "~0.9.0",
    "nativescript-dev-webpack": "~0.21.0"
  },

@RickyLarsen
Copy link

I'm getting the same behavior. I'm not even seeing the "No callback provided. Please ensure that you called "handleOpenURL" during application init!" error message.

@NL33
Copy link

NL33 commented Sep 23, 2019

Any update on this? I am trying to use the plugin to register universal links on iOS, and, after putting in the code from the docs, nothing happens.

@hypery2k
Copy link
Owner

sorry to say but have to quit the plugin as I don't have time to support it.

@NL33
Copy link

NL33 commented Sep 23, 2019

Wow. Is there an older plugin version that works with iOS for universal links? There is a stack overflow question here that implies someone was able to use it for universal links a year ago.

@NL33
Copy link

NL33 commented Sep 24, 2019

If you are looking to handle universal links, see the code in this stack overflow answer. This code does not require this plugin.

@farfromrefug
Copy link

@hypery2k please can you pass the ownership of the plug-in? Especially the npm package. Thanks

@hypery2k
Copy link
Owner

and to whom I should handover it?

@farfromrefug
Copy link

Me I will maintain it add contributors if they want

@daweedm
Copy link

daweedm commented Dec 20, 2019

Hello everyone, does anyone has a quick fix for this issue ?

@daweedm
Copy link

daweedm commented Jan 2, 2020

For anyone that would be still stuck with this : the plugin is working, even with iOS 13. The problem is related to plugins conflicts. In my case, for instance, it was related to nativescript-plugin-firebase, which overrides the "UIApplicationDelegate" to insert its own callback. Both nativescript-plugin-firebase and this plugins uses the same approach to catch the "open app from url" event. The plugins maintainers should align themselves and find a way to listen for AppDelegate events without conflicting with each others. The same problem occurs with the nativescript-facebook plugin.

@keithgulbro
Copy link

Any update on this? @daweedm makes a solid point. Many Nativescript plugins overwrite the iOS app delegate instead of allowing those methods to be called once the plugin is imported.

If the methods could be called inside of a iOS app delegate created by the app's developer, this functionality wouldn't conflict with other plugins.

@tobiasklemp
Copy link

Maybe the function handleOpenURL should hand through all of the parameters it gets from the delegate on ios. Then it would be possible to use this plugin whenever a custom app delegate is needed and even could be a peer dependency for plugins that require custom delegates.

@asharghi
Copy link

Any solution to this?

@farfromrefug
Copy link

Yes i wrote a new component for that . not in front of my computer but it should be nativescript-appurl

@asharghi
Copy link

Nice. Want to create a PR to this repo?

@farfromrefug
Copy link

@asharghi i wont. This plugin is not maintained anymore. I decided to go and maintain my own.
You decide which one you want to use!

@mikykonst
Copy link

@farfromrefug your plugin is not working with IOS too. Its working on debug but on release callback not working. Any solutions?

@farfromrefug
Copy link

@mikykonst no idea wreally. Works perfectly here in production. Must be related to your itunesconnect configs.

@mikykonst
Copy link

@farfromrefug May it me an issue with nativescript version?

{ "name": "MyApp", "license": "SEE LICENSE", "version": "0.0.0", "nativescript": { "id": "com.MyApp", "tns-android": { "version": "6.1.0" }, "tns-ios": { "version": "6.1.0" } }, "dependencies": { "@angular/animations": "~8.0.1", "@angular/common": "~8.0.1", "@angular/compiler": "~8.0.1", "@angular/core": "~8.0.1", "@angular/forms": "~8.0.1", "@angular/http": "~8.0.0-beta.10", "@angular/platform-browser": "~8.0.1", "@angular/platform-browser-dynamic": "~8.0.1", "@angular/router": "~8.0.1", "@nativescript/core": "^6.5.15", "@nstudio/nativescript-checkbox": "^1.0.0", "compare-versions": "^3.6.0", "crypto-js": "3.3.0", "font-awesome": "^4.7.0", "moment": "^2.27.0", "nativescript-angular": "~8.0.1", "nativescript-appurl": "^1.3.5", "nativescript-appversion": "^1.4.4", "nativescript-camera": "^4.5.0", "nativescript-contacts-lite": "^0.2.7", "nativescript-drop-down": "^5.0.6", "nativescript-http-formdata": "^1.7.0", "nativescript-imagepicker": "^7.1.0", "nativescript-iqkeyboardmanager": "^1.5.1", "nativescript-localize": "^4.2.1", "nativescript-mediafilepicker": "^3.0.1", "nativescript-microsoft-appcenter": "^2.0.0", "nativescript-permissions": "^1.3.9", "nativescript-secure-storage": "^2.6.1", "nativescript-theme-core": "~1.0.4", "nativescript-ui-listview": "^7.0.5", "nativescript-ui-sidedrawer": "^7.0.4", "nativescript-unit-test-runner": "^0.7.0", "reflect-metadata": "~0.1.13", "rxjs": "^6.5.5", "tns-core-modules": "^6.2.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/core": "~8.0.1", "@angular/cli": "~8.0.3", "@angular/compiler-cli": "~8.0.1", "@nativescript/schematics": "^0.7.3", "@ngtools/webpack": "~8.0.3", "@types/faker": "^4.1.12", "@types/jasmine": "3.3.16", "faker": "^4.1.0", "karma": "4.3.0", "karma-jasmine": "2.0.1", "karma-nativescript-launcher": "0.4.0", "karma-webpack": "3.0.5", "nativescript-dev-webpack": "^1.3.0", "node-sass": "^4.14.1", "tns-platform-declarations": "^6.5.15", "tslint": "^5.20.1", "typescript": "~3.4.3" } }

@farfromrefug
Copy link

@mikykonst i dont think so. I really thing it is an issue with your itunes config

@mohammadrafigh
Copy link

mohammadrafigh commented May 11, 2021

Just as a side note, my own problem was that I didn't set LSApplicationQueriesSchemes in info.plist of the source app (the app I'm trying to link from). It seems this key is required from iOS 9. After setting this key the forked version of @farfromrefug worked well. LSApplicationQueriesSchemes should be an Array with an item being your custom schema.

Reference: https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl?language=objc. Note the Important notice under Discussion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests