Universal Links and Apple App Site Association (AASA) - Implementation & Debugging

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome to icode I am pellav and today we are going to talk about aasa that is Apple website Association or if you are just starting with universal links and you are not aware of this technical jargon this is all that we'll be discussing today what are Universal links what they are used for how Universal links work while discussing this it will take us to something called aasa then we'll see that what is Asa how does it work how clicking on a URL opens your app and then most important of all what are the weird issues that comes up with aasa how to debug them and how to fix them so let's get started you would have experienced it at times clicking on a URL opens the app and at times it doesn't instead it takes you to Safari where you land on the web page for that URL so why is this difference what is the factor deciding that when the app should be opened and when should user be taken to the browser so essentially the apps which are having the handling for redirection they will deep link the user into the app and when the app is not installed the same URL will open in browser so because the same URL is working with both app and browser we call it Universal link and it is important to have this Universal link handling if you want to provide the rich experience of your app for example assume that you bought a product from amazon.com and you got the confirmation message with track order link say SMS or Whatsapp now if the user is having the Amazon app installed you would definitely like to open the app but in case the app is not installed you don't want to change the link you want the same link to work in a browser that is where something called aasa comes in website Association or aasa it is a way through which you can deep link the into the app using URLs of your web pages essentially it's a Json which looks something like this in this Json you mentioned that which URL should deep link to app and which one should be opened in browser now let's look at how do we set up aasa or Universal links first enable the associated domain for your app identifier next go to xcode and add Associated domain under the signing and capabilities mention your domain and subdomain here and prefix them with app links colon this will tell that your app should download that Json which we call aasa file if you have not done this before you would be thinking that how will the app come to know that from where it should download the Json what is the path for that aasa and for this Apple has made it really easy by setting up some rules the aasa file should be hosted at the root which means that if your domain is xyz.com then the path of Aisa would be xyz.com Apple website Association although it is a Json but that shouldn't be in your path simply your domain followed by slash and apple hyphen app hyphen site hyphen Association once you host the ASA on your server this is how it works when users install the app aasa is downloaded and cached the download path is identified by the domains mentioned in the associated domain section so make sure that your website where AAS is hosted it uses secure connection that is https it won't work with http so it should be hosted over https it should be at root any suffix like Json PHP aspx anything like that shouldn't be there size should not be more than 128 KB and the mime type should be application Json once all this is in place your Universal links should work when user Taps on the link which is not excluded in your ASA your app will be launched and you will receive an NS user activity object essentially the URL in the delegate methods in app delegate which you can then parse and deep link to the intended screen this is how the code would look like now your Universal links are working fine and you thought of making some changes in aasa maybe you want to exclude or include some parts how will it work because few minutes back I said that aasa is downloaded and cached on app install so how will your new changes work well this is taken care by OS after a regular interval a call is made to update the ASA so even when you update the ASA on your server it won't reflect immediately and if you want to know that what is the duration when is it updated stay with me for a couple of more minutes and we'll see something through which you will get this information with universal links the most common issue that developers generally face is links are opening in browser and not in app so let's see that how to debug this the only cause for this Behavior can be your aasa was not downloaded or the Json is not correct let's look at both of these when I say that your aasa would not have been downloaded what can be the possible reasons maybe it's not hosted over https maybe it's not at the root maybe the size constraint 128 KB maybe the mime type was different or maybe it is not accessible by Apple servers yes this happens at times so assume that you are receiving a lot of traffic from the countries where you are not having your user base and you identified that that these may be the Bots these are not the genuine users to handle this you set up the rules on your CDN for restricting the traffic and this will restrict downloading of aasa 2. so even when your user is in India or news the lender Canada or whatever location when the app will be installed the request for downloading the ASA is routed through Apple servers and since we don't know that where those servers are the rule setup on your CDN will restrict it the second part that Json is not correct so there's a predefined structure for AAS Json and in case you missed on following it you can validate it through ASA Json validators available on the internet I prefer the one provided by branch and I'll put the link in the description it checks for DNS validation https checks any bad request or denials from your server content type header and the Json validation so 99 of the times this tells you that what the issue is and for the rest one percent cases where you think that everything is correct even then the universal links are not working here's a way to debug it we discussed that the Json is downloaded and cached by the system so it makes sense to check that cache that what actually was downloaded so this is done by generating a system diagnose file hold the volume buttons both up and down along with the log button press three of them together and hold on for a second till you get a haptic feedback once you do this the system will start preparing a system diagnose file since this file is very large in size around 300 to 500 MB it takes some time so wait for 5 minutes or so and then go to settings privacy and security and then analytics and improvements under analytics and improvements click on analytics data and scroll till you get the files starting with letter s there you would get assist diagnose file airdrop it to your Mac and unzip after unzipping you would see a file called swc util underscore show this file will have a lot of information related to memory usage database app links well we can ignore the pieces which are not relevant to us we should be focusing on the app links related information for our app to find it hit command F and search for your app ID or the domain against service you would see app links app ID will have your apps ID domain will have the domain mentioned in the associated domain section and most importantly patterns will have the Json that you are looking for if there's anything wrong you won't get the Json here instead you would see an error with that error you will get to know that who is the culprit what should be fixed you would also see two time stamps for last checked and next check the next check tells that when will the system attempt to download the Json again if you have made any changes in the ASA it will start reflecting after this so if you think that everything is Right still Universal links are not working give this a try the error object will give you detailed information sufficient enough for debugging and then you can fix the things so that's pretty much for this video I hope you found it useful if you like the content of this Channel please consider subscribing see you in next video till then Happy coding and stay safe
Info
Channel: iCode
Views: 30,194
Rating: undefined out of 5
Keywords: universal link, aasa, apple app site association, deeplink, deeplinks, ios, swift, icode, pallav, pallav trivedi, debugging, mobile app development, apple development, ios developer, ios development, sysdiagnose, applinks, aasa json, asa, app redirection, app navigation, nsuseractivity, push notification
Id: oJaxHabyp-4
Channel Id: undefined
Length: 8min 34sec (514 seconds)
Published: Mon Jan 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.