Reputation: 929
Using Visual Studio CE 2022 17.44
Following the directions for setting up appLinks on iOS, one of the steps is to add the Entitlements.plist with the following:
<?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>
<array>
<string>applinks:popupshop.azurewebsites.net</string>
<string>applinks:*.popupshop.azurewebsites.net</string>
</array>
</dict>
</plist>
I then add the Entitlements.plist as the custom resource rules file:
This adds this line to the project file:
<CodesignResourceRules>Platforms\iOS\Entitlements.plist</CodesignResourceRules>
Once this has been added the project no longer builds. If I remove it or replace it with:
<CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
as per someone's suggestion, the project will build again, but accessing the applink does not switch over to the app. https://popupshop.azurewebsites.net/findshop
I have the apple-app-site-association file available at https://popupshop.azurewebsites.net/apple-app-site-association and https://popupshop.azurewebsites.net/.well-known/apple-app-site-association
which contains:
{
applinks: {
apps: [ ],
details: [
{
appID: "75Q8SL8Q65.net.popupmobile.popupshop",
paths: [ "/findshop/*" ]
}
]
}
}
Not sure why the tag entered by Visual Studio blows up the build. UPDATE: the error is the following:
Severity Code Description Project File Line Suppression State
Error Failed to codesign '/Users/user/Library/Caches/Xamarin/mtbs/builds/PopUpShop.Mobile.Maui/35dcaca089e6ce3e7267432b2824427bbb34327e5d2422b0725e05c26c8d46db/bin/Debug/net7.0-ios/ios-arm64/device-builds/iphone15.3-16.1.2/PopUpShop.Mobile.Maui.app':
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
bin/Debug/net7.0-ios/ios-arm64/device-builds/iphone15.3-16.1.2/PopUpShop.Mobile.Maui.app/ResourceRules.plist: cannot read resources
PopUpShop.Mobile.Maui C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.1.1477\tools\msbuild\iOS\Xamarin.Shared.targets 2128
UPDATE: The VS Screen shot above is different than what i see on the Microsoft site (see below). I am missing the 'Custom Entitlements' section for some reason.
Upvotes: 4
Views: 4011
Reputation: 929
Not sure why my visual studio is broken, but if yours is the same and you want to add Entitlements.plist, add the following to your project.csproj under the ios debug and release sections:
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
....
<CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
Upvotes: 7