【问题标题】:Why is Deep Link Web URL query is empty为什么 Deep Link Web URL 查询为空
【发布时间】:2020-06-22 09:46:31
【问题描述】:

使用 Flutter 和 Firebase 动态链接,我可以创建链接。单击它时,它会打开应用程序,但没有链接数据,并且不会触发单击链接的回调。相反,在 Xcode 日志中,我得到 Deep Link Web URL query is empty 链接从应用程序复制到 Notes,然后单击。我有什么遗漏的吗,或者我还可以检查什么才能使其正常工作?

Firebase Deep Link Web URL query is empty - iOS 检查了这篇相关帖子,但安装所需的 pod 依赖项并不是解决方案,您可以在下面的 pod 安装日志中看到。

颤振医生

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15 19A582a, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.5)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.4)
[!] IntelliJ IDEA Community Edition (version 2019.1.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.43.0)
[✓] Connected device (1 available)

! Doctor found issues in 2 categories.

Xcode 日志

---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 4.0.7
System information: OS iOS, OS version 13.3.1, model iPhone
Current date 2020-03-10 12:46:34 +0000
Device locale en-US (raw en_US), timezone America/Boise
    Specified custom URL scheme is com.pitch.links and Info.plist contains such scheme in CFBundleURLTypes key.
    AppID Prefix: XXXXXXXXXX, Team ID: XXXXXXXXXX, AppId Prefix equal to Team ID: YES
performDiagnostic completed successfully! No errors found.
---- Firebase Dynamic Links diagnostic output end ----
Runner[366:14705] 6.18.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
Runner[366:14754] 6.18.0 - [Firebase/Analytics][I-ACS800003] Registered an SDK that has already registered. Default flags will be overwritten. SDK name: app_measurement
Runner[366:14754] 6.18.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
Runner[366:14712] Connection 3: received failure notification
Runner[366:14712] Connection 3: failed to connect 12:8, reason -1
Runner[366:14712] Connection 3: encountered error(12:8)
Runner[366:14712] Task <03A1535D-FD13-4872-B14B-6673E202F028>.<2> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
Runner[366:14712] Task <03A1535D-FD13-4872-B14B-6673E202F028>.<2> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x282e21b30 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=https://firebasedynamiclinks-ipv6.googleapis.com/v1/installAttribution?key= AIzaxxxxxxx_xxxxxxxxxx_xxxxxxxxxxxxxxxx, NSErrorFailingURLKey=https://firebasedynamiclinks-ipv6.googleapis.com/v1/installAttribution?key= AIzaxxxxxxx_xxxxxxxxxx_xxxxxxxxxxxxxxxx, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}
Runner[366:14505] [ProcessSuspension] 0x10e4e13b0 - ProcessAssertion::processAssertionWasInvalidated()
Runner[366:14505] [ProcessSuspension] 0x10e4e1410 - ProcessAssertion::processAssertionWasInvalidated()
Runner[366:14707] 6.18.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
Runner[366:14707] 6.18.0 - [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
    dismiss = 1;
    "is_weak_match" = 1;
}
Runner[366:14505] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
Runner[366:14505] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
Runner[366:14505] Returning local object of class NSString
Runner[366:14505] Can't end BackgroundTask: no background task exists with identifier 14 (0xe), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Runner[366:15138] 6.18.0 - [Firebase/Analytics][I-ACS023000] Deep Link Web URL query is empty

苹果应用网站关联

{"applinks":{"apps":[],"details":[{"appID":"XXXXXXXXXX.com.pitch.links","paths":["NOT /_/*","/*"]}]}}

applinks:pitchlink.page.link 被列为关联域 和带有 Bundle ID 和 URL 方案标识符的 URL 类型 com.pitch.links 已添加到 Info.plist

Flutter main.dart

import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Dynamic Links',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Dynamic Links'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Uri dynamicUrl;

  @override
  void initState() {
    super.initState();
    this.initDynamicLinks();
  }

  void initDynamicLinks() async {
    final DynamicLinkParameters parameters = DynamicLinkParameters(
      uriPrefix: 'https://pitchlink.page.link',
      link: Uri.parse('https://example.com/suffix?d=1'),
      iosParameters: IosParameters(
        bundleId: 'com.pitch.links',
        minimumVersion: '0.0.1',
      ),
    );
    FirebaseDynamicLinks.instance.onLink(
        onSuccess: (PendingDynamicLinkData dynamicLink) async {
      final Uri deepLink = dynamicLink?.link;
      print(deepLink.toString());
    }, onError: (OnLinkErrorException e) async {
      print('onLinkError');
      print(e.message);
    });
    ShortDynamicLink link = await parameters.buildShortLink();
    setState(() {
      dynamicUrl = link.shortUrl;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Dynamic Link:',
            ),
            dynamicUrl != null
                ? SelectableText(
                    dynamicUrl.toString(),
                  )
                : Container(),
          ],
        ),
      ),
    );
  }
}

pubspec.yaml

name: pitch_links
description: A new Flutter project.
version: 0.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase_dynamic_links: ^0.5.0+11
  firebase_analytics: ^5.0.11
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

pod install --clean-install --verbose

-> Using Firebase (6.18.0)
-> Using FirebaseAnalytics (6.3.0)
-> Using FirebaseAnalyticsInterop (1.5.0)
-> Using FirebaseCore (6.6.3)
-> Using FirebaseCoreDiagnostics (1.2.1)
-> Using FirebaseCoreDiagnosticsInterop (1.2.0)
-> Using FirebaseDynamicLinks (4.0.7)
-> Using FirebaseInstallations (1.1.0)
-> Using Flutter (1.0.0)
-> Using GoogleAppMeasurement (6.3.0)
-> Using GoogleDataTransport (4.0.1)
-> Using GoogleDataTransportCCTSupport (1.4.1)
-> Using GoogleUtilities (6.5.1)
-> Using PromisesObjC (1.2.8)
-> Using firebase_analytics (0.0.1)
-> Using firebase_dynamic_links (0.1.0)
-> Using nanopb (0.3.9011)

【问题讨论】:

    标签: ios xcode firebase flutter firebase-dynamic-links


    【解决方案1】:

    解决我的问题的解决方案是在initDynamicLinks() 中调用await FirebaseDynamicLinks.instance.getInitialLink(); 相同的错误仍然出现在 Xcode 日志中,但我能够解析出链接数据。

    【讨论】:

    • 我添加了await,但对我不起作用
    猜你喜欢
    • 1970-01-01
    • 2021-02-17
    • 2019-06-09
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 2022-10-25
    • 2016-03-21
    • 1970-01-01
    相关资源
    最近更新 更多