You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

info.plist配置Deep-link后Safari无响应,提示无法找到服务器求助

Hey there, let's troubleshoot this deep link issue step by step. The error you're seeing ("Safari cannot open the page because the server cannot be found") is a big clue here—let's break down what's going wrong and how to fix it:

1. Your URL Scheme Format is Confusing Safari

The scheme you're using (myapp.com) includes a dot, which makes Safari interpret it as a web domain instead of an app deep link. When you try to open it, Safari attempts to send an HTTP request to myapp.com (which doesn’t exist as a public server), hence the error.

Fix: Switch to a simple, dot-free scheme like myapp. Update your Info.plist to this:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.myapp.customer</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myapp</string>
        </array>
    </dict>
</array>

If you’re just typing myapp.com into Safari’s address bar, Safari automatically prepends http:// to it, turning it into a web request instead of a deep link.

Proper Testing Methods:

  • Create a simple HTML file with a link: <a href="myapp://">Open My App</a>, open this file in Safari, and tap the link.
  • Type the full deep link directly into Safari’s address bar: myapp:// (don’t forget the :// suffix).
  • Use the Notes app: Type myapp://, long-press it, and select "Open in [Your App Name]".
  • For simulator testing, run this terminal command: xcrun simctl openurl booted myapp://
3. Verify Your App is Properly Installed & Configured
  • Make sure you’ve rebuilt and reinstalled your app after updating the Info.plist—changes won’t take effect until you do this.
  • Double-check that the CFBundleURLTypes configuration is applied to your main app target (not a test or extension target).
  • For iOS 13+, confirm you haven’t disabled deep links for your app in Settings > [Your App] > Safari > Allow Website Access (it should be set to "Allow" or "Ask").
4. Optional: Add LSApplicationQueriesSchemes (For Cross-App Launches)

While this isn’t required for Safari to open your app, if you plan to launch your app from another iOS app (not just Safari), add your scheme to LSApplicationQueriesSchemes in Info.plist to avoid runtime errors:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>myapp</string>
</array>

内容的提问来源于stack exchange,提问作者Mehrdad

火山引擎 最新活动