Apple-app-site-association file not loading

I uploaded the apple-app-site file binding file to the root of my https web server. After that, I added my associated domains to xcode. I followed the tutorial on Apple's universal link.

[SWC] ### Refusal to redirect to ' https://examplecustomdomain.com/apple-app-site-association/ ' (original ' https://examplecustomdomain.com/apple-app-site-association ')

I checked the device logs and I saw the error described above

+4
source share
3 answers

An attempt to implement the functionality of Universal Links recently appeared in the same problem. fbeeper gave a good answer that helped me confirm that the forwarding really happened.

However, this did not help me determine how to solve the redirect problem. Therefore, for people like me working with a Ruby on Rails-based database, here is an example of how to serve this annoying app-site apple-app-site file in a way that meets all Apple requirements:

  • Put json file apple_app_site_association in shared folder
  • In your file config/routes.rbadd a line, for example:

get '/ apple-app-site-association' => 'home # apple_app_site_association'

  • Then, in the controller file (home_controller in this example), define your method:

    def apple_app_site_association association_json = File.read(Rails.public_path + "apple-app-site-association") render :json => association_json, :content_type => "application/pkcs7-mime" end

+3
source

:

[SWC] ### Denying redirect to 'https://www.<domain>/apple-app-site-association' (original 'https://<domain>/apple-app-site-association')

Apple:

  • https:// (, Safari ).

  • .

  • MIME/pkcs7-mime.

, - - , . , ; , , .

curl -i https://<domain>/apple-app-site-association, HTTP/1.1 301 Moved Permanently, Location: https://www.<domain>/apple-app-site-association ( ).

+2

https.

:

1) Create a file of type apple_app_site_association without extension in the public directory of the rails application with the following contents

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "<TEAM_DEVELOPER_ID>.<BUNDLE_IDENTIFIER>",
                "paths": [ "*" ]
            }
        ]
    }
}

2) routes.rb

get '/apple-app-site-association', to: 'pages#apple_app_site_association'

3) pages_controller.rb

def apple_app_site_association 
   association_json = File.read(Rails.public_path + "apple_app_site_association")
   render :json => association_json, :content_type => "application/json"
end

For example, you check

http://18.216.158.101/apple-app-site-association

To check, you can create an application on the hero.

0
source

Source: https://habr.com/ru/post/1619109/


All Articles