There are various resources on deep linking with react native. However, I have a react app inside an IOS app and I'm not using React Native. How can I get a deep linking to work in that situation?
I have tried something like this:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import Login from './Components/Login'
import iosDeepLink from './Components/iosDeepLink'
ReactDOM.render(
<BrowserRouter>
<div>
<Switch>
<Route exact path="/login" component={Login} />
<Route exact path="/apple-app-site-association" component={iosDeepLink}/>
<Route path="/" component={App} />
</Switch>
</div>
</BrowserRouter>
, document.getElementById('root'));
Where Browser Router redirects association URL to component iosDeepLink:
import React, { Component } from 'react';
export default class DeepLink extends Component {
render() {
return '{"applinks":{"apps":[]"details":[{"appID": "MYTEAMCODE.MYCOMP.MYAPP","paths":["*"]}]}}';
}
}
not working. I guess it's because there are the other divs and structures that react produces to get to that scene, and it's not just plain text of the association file.
I used this website to verify, and I got these two errors:
- Your file's 'content-type' header was not found or was not recognized.
- JSON test did not run. Your file should contain valid JSON.