Google Map APIs not working after adding bundle identifier - iOS - ios

I Google developer console I created an iOS key as below:
I want to restrict this key to one app only, so I "Edit allowed iOS application" add my bundle Id to it. My bundle Id is easily found in General tab of my project target as following:
I don't know if it is case-sensitive or not, but I copy exactly the identifier from there to add to the key. As you can see, it cannot be mistaken. I also followed Google's instruction, one bundle Identifier per line (I only input one line):
Accept requests from an iOS application with one of the bundle
identifiers listed below (Optional) One bundle identifier per line.
Example: com.example.MyApp
Or if you leave this blank, requests will be accepted from any iOS
application. Be sure to add bundle identifiers before using this key
in production.
This screen show that I enabled all necessary services, to be sure:
The problem with me is that, whenever I added a bundle identifier to the key, my app stops working. But then when I deleted it (now "Any application allowed" as in the picture), everything goes back to work fine.
Could anyone please tell me what could possible cause this?
UPDATE: To clarify more: When I add my bundle ID to the key in Developer Console, now I can still use nearby search in my app. But Autocomplete search and Google URL shortener have stopped working..

whatever request that is getting 403 should be sent with additional header X-Ios-Bundle-Identifier, where your bundle id should be set. This seems undocumented, I only found it through jumping between links, see this...

The reason Autocomplete stops working when you add an iOS Bundle ID is that Google Places API Web Service is specifically not designed for using on iOS. As a gentle hint, I suggest you poke around Google Places API for iOS after Google I/O happens later this week. =)

I also ran into this issue and solved it by following #zhywu's answer above
The Swift 5 code that leverages URLSession/URLSessionDataTask looks like this:
if var urlComponents = URLComponents(string: "https://www.googleapis.com/...") {
...
guard let url = urlComponents.url else { return }
var request = URLRequest(url: url)
request.setValue(Bundle.main.bundleIdentifier ?? "", forHTTPHeaderField: "X-Ios-Bundle-Identifier")
dataTask = defaultSession.dataTask(with: request) { ... }
...
}

Related

Firebase dynamic link is not working on IOS

We have been using firebase dynamic link on android for a while.It was working fine in android.
We have decided to build our project on IOS platform also.Now we are facing some problems in dynamic link.
On pressing the link our application does not open.We also following the tutorial to integrate dynamic link on IOS.
1.Added .Plist file.
2.Added associated Domain in capabilities.(applinks:domain-link)
3.Added URL Types in info.
4.Added Team ID.
Seems like we are following the exact steps in the documentation. And yet Dynamic link is not working for us.
Can anyone help us in resolving this issue?
check
Apple Developer enable your Associated Domains from your app Identifiers
check AASA file team id and bundle id from https://{your set domain}.page.link/apple-app-site-association
AASA effective not real time
open your note app input https://xxx.page.link/ooo test (not on browser)
I hope I can help you
You need to update your AppDelegate.m file as well. Follow from steps 4 mentioned in the section Open Dynamic Links in your app here
please cross check associated domains : (it must not contain http or https e.g. applinks:myapp.page.link ) .and Dynamic link is easily work on iOS Simulator , I don't get any issues.
And if you creating dynamic link from firebase ios sdk then below code will be useful
guard let link = URL(string: "Write your link here and parameters") else { return }
let dynamicLinksDomainURIPrefix = "https://racematesios.page.link" //domain-link
let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix )
linkBuilder!.iOSParameters = DynamicLinkIOSParameters(bundleID: "Bundle ID")
linkBuilder!.iOSParameters?.appStoreID = "App store ID"
guard let longDynamicLink = linkBuilder?.url else { return }
print("The long URL is: \(longDynamicLink)")
i'm using a Flutter App and on Android i can read internal link with custom parameter, however, on iOS i can not, the App is opened but onLink.listen is never called. I did all iOS platform configuration posted on documentation.
The link used to open the App looks like (Long Dynamic Link):
https://sample.page.link/?link=https://sample.page.link/test?CUSTOM_PARAM=fooBar&apn=br.com.test&isi=12345&ibi=br.com.test
The idea is to use only one dynamic link and pass dynamic data as custom parameter. Did anyone face that problem?

Open application on button tapped with Bundle Identifier (Without url scheme)

I'm currently developing an app and i'm trying to add a button which would open another app installed on my phone when the button is tapped
I've tried looking for the URL scheme for the app but i can't find it. Only thing i can find is the bundle ID. So i thought maybe there's a way to use the bundle ID to open the app through private APIs in Swift? My phone is jailbroken if that helps. Below is my code
#IBAction func openAppTapped(_ sender: Any) {
UIApplication.shared.openURL(NSURL(string: "itms-apps://itunes.apple.com/us/app/apspace/id1413678891?mt=8")! as URL)
}
I managed to upon the app on the appstore upon tapping the button but i want a way to open the app directly without using url schemes but instead using the bundle id and/or private APIs. Any help would be really really appreciated!
To open another app, you are either going to have to use some kind of extension provided by that app or figure out their URL scheme and reverse engineer it.
The first thing you could try is looking at the app's Info.plist and seeing if they have defined a URLScheme for their app. If not, and they haven't implemented an extension, then I think you're SOL.
If they did define it, try using it to open their app and see what happens, they might have some code that rejects or accepts a request to open their app based on the format of the URL after their scheme. If you can't figure it out with trial and error, you could use the fact that your phone is jailbroken to decompile their app and hunt down the URL parsing logic which is likely in their AppDelegate. From there you could try and build a URL that you can use to successfully open their app every time.

How to open line app with specified line user id chat screen?

I am opening LINE app from my native iOS app and my requirement is, i need to open line app with specified user chat screen.
I am not able to open specified user chat screen with line URL scheme. I tried below URL schemes but it only open line app. Please help me on this where i am doing wrong.
line://oaMessage/UserlineID
https://line.me/R/ti/p/UserlineID
line://ti/p/UserlineID
I had similar issue. I finally found a solution:
http://line.me/ti/p/~{LINE_id}
Just add ~ in front of {LINE ID}
With this way you can open line app with specified user.
if let url = URL(string: "line://ti/p/#UserlineID") {
UIApplication.shared.openURL(url)
}
Put your line id after #. Like line://ti/p/#jld859s8
Swift 4:
if let url = URL(string: "line://ti/p/#UserlineID") {
UIApplication.shared.openURL(url, options: [:],completionHandler:nil)
}
For Line Messenger you can follow three general strategies to connect with other users:
Firstly, some others have already suggested this, you can use this link:
line://ti/p/<LINE_ID>
The problem is that this link has been depreciated due to a security vulnerability
source: https://developers.line.biz/en/docs/messaging-api/using-line-url-scheme/#if-the-user-hasn-t-installed-line
Secondly you can use the more recent link:
https://line.me/ti/p/<LINE_ID>
This redirects to a page with a Line Messenger QR Code, that your user can use to trigger the opening of the app. Its a halfway solution (although safer than #1)
Lastly if you want to save your users from the extra action/click, Line also allows you to download the QR Code from the app itself, so you could display that directly to your users in the desired location.
They have updated their documentation.
What we shall do now is follow this pattern
https://line.me/R/oaMessage/{LINE ID}/?{text_message}
For instance, if we want to send "Hello" to Line ID #abc, we shall use https://line.me/R/oaMessage/#abc/?Hello
I hope this helps someone who is searching for the latest available approach.
line://ti/p/~phuongledao?oat_referrer=PROFILE
use this link to open the app from the browser
https://line.me/R/ti/p/UserlineID
line://ti/p/UserlineID
The above schemes don't always work (it could work with some UserID but not with others), I called Line support and they give me another alias for the UserID (this time without the #) and it works normally.

Firebase.google.com Firebase Dynamic Links in iOS ( Swift )

How to Open an iOS App using Firebase Dynamic Links and Pass or get Parameters To an App Via Custom URL Scheme in iOS(swift)?

for eg :- https://q3tyj.app.goo.gl/abcd
My URL Scheme is ‘q3tyj.app.goo.gl’ in iOS app in Url Types.
If I type q3tyj.app.goo.gl in safari, I am able to open the application. But if I type q3tyj.app.goo.gl with some extra parameter like https://q3tyj.app.goo.gl/abcd in safari, , I am not able to open the application.

please also explain me how to get “link” parameter (which associated with dynamic link) from dynamic link in iOS app ( Swift ) .


I followed steps which were mentioned in Firebase.google.com for iOS ( Swift ).but its not working.
Thanks,
Nirav Virpara
It's hard to know exactly where your error is, but a few things to help you debug:
If you go to https://q3tyj.app.goo.gl/apple-app-site-association, you should see some JSON that points to your app. If you don't see this, make sure you've entered your team ID and your App Store ID in the project settings in the Firebase console
Make sure you're using your Bundle ID, not the shortlink domain, as your custom URL scheme in Xcode
Make sure you've enabled Associated Domains in the Capabilities tab of your Xcode project, and your domain looks like applinks:q3tyj.app.goo.gl
Universal Links (and, therefore, Dynamic Links) generally don't work if you type them directly into the Safari address bar. Instead, try typing the URL into an app like Notes and then clicking on them from there.
Good luck!
If you type https://q3tyj.app.goo.gl/apple-app-site-association this link in your browser and check, you will end up seeing a json, meaning your apple-app-site-association is correctly configured on your google website. However, you need to make sure that teamid in your google console or appid is correct.

Why do we need "URL Identifier" (CFBundleURLName) plist field to use custom URL scheme on iOS?

I am using a custom URL scheme to open my iOS app when this web link is tapped on the device: Demo77://someurl
To set it up, I added Demo77 as an item to the URL Schemes (CFBundleURLSchemes) array in the Info.plist.
Apple documentation says I also need to include URL identifier (CFBundleURLName) string key into the Info.plist. This key contains the "abstract name of the URL scheme".
I did not include the URL identifier key and the links still open my app. Everything works without the URL identifier.
Question: do I really need to include the URL identifier key in the plist? And if so - why?
Update
This question is different from URL identifier and URL scheme where it is asked what "URL Identifier" key is used for. I am not asking what it is used for. I am asking if we need to use "URL Identifier" at all? URL schemes in my app work perfectly well without it. Note that answers to the URL identifier and URL scheme question do not address my question at all. Sorry if my initial question was not clear enough.
According to apple docs
The identifier you supply with your scheme distinguishes your app from others that declare support for the same scheme.
Although using a reverse DNS string is a best practice, it does not prevent other apps from registering the same scheme and handling the associated links. Use universal links instead of custom URL schemes to define links that are uniquely associated with your website.
So to answer your question adding a url identifier doesn't change much,but its best to include it,as it is specified by apple.
If you have 2 application installed with same URL scheme like:
yourscheme://
then you have 2 conflicting apps.
How will the system decide to open which application launch?
According to the Inter-App Communication documentation
If more than one third-party app registers to handle the same URL
scheme, there is currently no process for determining which app will
be given that scheme
Please check this answer for the user who experienced the issue:
Also as far as I've tested and experienced, if you have 2 conflicting
apps, it appears to be the first one installed which is used, and when
this app is removed the second app which is now the only app
supporting the specific URL scheme is still not used
Hope it helps.
The URL Identifier is the reversed domain address which is should be the same as your Bundle Identifier e.g. com.companyname.appname
The URL Schemes is the start of the URL e.g 'appname'. When you call this as a URL it targets the bundle identifier which launches the app.
Reference : URL Identifier and URL Schemes

Resources