Validate that apple-app-site-association
files are set up correctly
The idea is you can use these functions in your test suite for doing automated tests on the validity of your apple-app-site-association file
apple-app-site-association
filesTo fetch the apple-app-site-association
files, create a URL which is your domain, such as
let domainUrl:URL = URL(string:"https://www.example.com")!
and retrieve the two urls for the allowed locations like so:
let appleAppSiteAssociationURLs:[URL] = try! domainUrl.urlsForAppleAppSiteAssociation()
Then use the urls to fetch the files. it shoudle exist at one of the two locations.
apple-app-site-association
fileOnce you've fetched the Data of the apple-app-site-association
file, deserialize it with a JSONDecoder
, like so:
let appleAppSiteAssociation:AppleAppSiteAssociation = try! JSONDecoder().decode(AppleAppSiteAssociation.self, from: data)
Test which app ids can be linked for a given URL, using the .matchedAppIds(...)
method.
let testUrl:URL = URL(string: "https://www.example.com/buy/")!
let testAppId:String = "ABCED1234.com.example.app"
XCTAssertEqual(appleAppSiteAssociation.applinks?.matchedAppIds(testUrl).contains(testAppId), true)
Each class within contains its own testing methods and its properties can be introspected.
percentEncoded
is not handled correctly
link |
Stars: 1 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics