How to debug a Xamarin.iOS Universal Link in Visual Studio Mac?

Yongqing Huang 241 Reputation points
2022-03-31T21:34:48.393+00:00

The Xamarin Universal Link in my app doesn’t work:

The method OnAppLinkRequestReceived(Uri uri) cannot be fired as expected, when an URL is tapped.

curl -i https://axin.be/apple-app-site-association
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 31 Mar 2022 20:52:39 GMT
Content-Type: application/json
Content-Length: 182
Last-Modified: Mon, 28 Mar 2022 08:53:37 GMT
Connection: keep-alive
ETag: "62417791-b6"
X-uri: location = Axin loc1s /apple-app-site-association
Content-Type: application/json
Accept-Ranges: bytes

{
"applinks": {
"apps": [],
"details": [
{
"appID": "******.benes.axinmobile",
"paths": ["*"]
}
]
}
}

Associated Domains is enabled for this App ID.

Provisioning profile is ok, I think. The release version of the app can be deployed to my iPhone. But the debug version the app of cannot be deployed to my iPhone.

It runs well except the universal link.

It runs well in simulator in debug mode, except the universal link.

There is no info about the error regarding the universal link.

I have no idea about whether apple-app-site-association is initiated.
I tried with Visual Studio Mac 2019 and 2022.
The results are same.

Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>CFBundleDisplayName</key>
<string>AxinMobile</string>
<key>CFBundleIdentifier</key>
<string>benes.axinmobile</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>benes.axinmobile</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>HTTPS</string>
<string>HTTP</string>
</array>
</dict>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>benes.axinmobile</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>

Entitlements.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<string>applinks:axin.be</string>
<key>get-task-allow</key>
<false/>
<key>com.apple.developer.web-browser</key>
<true/>
</dict>
</plist>

Any advice is welcome! Thanks in Advance.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 33,091 Reputation points Microsoft Vendor
    2022-04-01T03:51:42.237+00:00

    Hello,

    The release version of the app can be deployed to my iPhone. But the debug version the app of cannot be deployed to my iPhone.

    Because you set this key ( get-task-allow ) false. When you debug the app on your device, set it true. It means the ability to debug your application on the iPhone. Distribution profiles require that this value be turned off, while development profiles require this value to be turned on.

    I have no idea about whether apple-app-site-association is initiated.

    Your apple-app-site-association looks correct, ****** may be your Team ID, and it has been uploaded to the root of your HTTPS web server. You could test your Web Page URL on https://search.developer.apple.com/appsearch-validation-tool. But when I enter https://axin.be and test, it said "Recommended Could not extract image.", "Action required Could not extract a touch icon.", "Action required Could not extract required information for Universal Links. ". You could edit your webpage, refer to https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html#//apple_ref/doc/uid/TP40002051-CH3-SW4
    https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1

    If your web page is correct, and you have the development app deployed on your device, you could send https://axin.be via iMessage, and click this message to check if it could jump to the webpage, and then jump to your App.
    Try removing the following keys to test if you can open the web page through Safari and jump to your app when you click the message.

    <key>com.apple.developer.web-browser</key>  
    <true/>  
    

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Yongqing Huang 241 Reputation points
    2022-04-06T10:00:02.883+00:00

    190440-image.png

    URL: deeplink://test opened in iMeaasege. it works!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.