在Ionic中接收ios的URL

Hit*_*sal 23 ios phonegap-plugins cordova ionic-framework ionic

我正在使用离子框架.我正在尝试设置一种方法来接收来自其他应用的网址.比如,您在浏览器中,单击共享,并将链接发送到另一个应用程序(我的应用程序).我找到了这个cordova插件,并将其集成到我的应用程序中.但这是Android的普及.我在IOS中需要相同的功能.

我知道哪个插件需要用于ios

我为Android采取的步骤

1)cordova插件添加git://github.com/Initsogar/cordova-webintent.git 2)检查config.xml文件并找到webintent的代码

<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

和app.js代码

if (window.plugins && window.plugins.webintent) {
  window.plugins.webintent.getUri(function(url) {
    alert("getUri url:"+url);
  });
}
Run Code Online (Sandbox Code Playgroud)

在ios中对功能相同的任何建议?

谢谢

eng*_*can 17

您只需要Custom-URL-scheme cordova插件.

你也可以手动完成.对于iOS,请添加到您的*.plist.或者你可以看看第5步

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>URL_SCHEME</string>
    </array>
  </dict>
</array>
Run Code Online (Sandbox Code Playgroud)

在iOS中添加自定义方案后,它会自动调用一个名为的函数handleOpenURL.

对于android添加AndroidManifest :(在android中你甚至可以听http方案)

<activity android:label="@string/app_name" android:name="com.yourpackage.name">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http" android:host="example.com" android:pathPrefix="/" />
        <data android:scheme="https" android:host="example.com" android:pathPrefix="/" />
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)


Vin*_*Dev 3

您所要求的是您的应用程序的深度链接设施。虽然我无法为您提供确切的解决方案,但它相当简单,只需将几行代码写入本机 ios 应用程序的 .plist 文件(就像您在 manifest.xml 中为 android 所做的那样)。它被称为URL scheming,你也可以为你的 ios 应用程序制作一个。

请访问http://docs.urbanairship.com/topic-guides/ios-deep-linking.html。我希望它能为您提供如何做到这一点的指导。

打开“另一个提供深度链接设施的应用程序(如youtube等)”的角度/离子代码 - https://medium.com/angularjs-articles/deep-linking-in-ionic-mobile-applications-44d8b4685bb3