Swift open Maps application show specific address pins ( branches )? - swift

I am trying to open Maps application on iOS from my app by providing a name of big company such as Orange for example and show all the company branches on the map .
so far i tried lots of solutions before i posted my question , i found this solution but its not working :
if let url = URL(string:"http://maps.apple.com/?address=United States,Orange S.A.") {
UIApplication.shared.open(url)
}
is it possible to find solution for my request? or i have to make my own map and pins inside the application ?

For People show is searching for same solution :
if let url = URL(string:"http://maps.apple.com/?q=Search+Text+here") {
UIApplication.shared.open(url)
}
i used q instead of address to query the search
also add + between words otherwise it wont work

Related

NFC and Flutter implementation

I have been searching and googling for how NFC works with mobile apps , but I was not able to get the whole picture .
I want to make an NFC based Device with Arduino , something like this :
https://arduinogetstarted.com/tutorials/arduino-rfid-nfc
so basically I want my app to be able to communicate with my Arduino so when my mobile is close to it it will identify it and do something based on my code .
I have heard of many packages on pub like : nfc_manager to help me achieve that .
my extra question is there is something i can do to make the app only recognize the Arduino NFC reader that i made ?
Looks like you can't, but you can make assertion on the tag technology and only execute logic if the tag tech is the same as the one you put on your arduino
From the article you post, it looks like your tag is a MiFare tag. So you can use this static method of the MiFare class :
static MiFare? from(NfcTag tag) => $GetMiFare(tag);
The result of this is a nullable MiFare object, so in your code you can do :
tech = MiFare.from(tag);
if (tech is MiFare) {
// enter code here
}
You can also check that tech != null is true
This make your app only look for the same kind of NFC tag as the one you have. If you want more fine grain control, you might want to make some assertion on the data of the tag.

Swift-YouTube-Player : Not able to read available videos

I'm using https://github.com/gilesvangruisen/Swift-YouTube-Player to read youtube videos in my app such as this one : https://www.youtube.com/watch?v=Bw0tjdBgKBY
With a WEB browser it works well, but using the library, a message appears saying :
This video is unavailable
I can see the video preview before playing the video, but when the video starts the message appears in my app.
Is there video contents locked by youtube when using this kind of library ?
Every video published by FIFATV seems to be unavailable using this library...
I'm setting the video in the youtubePlayer like that :
youtubePlayerView.loadVideoURL(URL(string: "https://www.youtube.com/watch?v=PBTFz-9bozc"))
Other videos not from FIFATV are working.
Any idea concerning the problem ?
To understand what happened to your streaming, you should add another parameter, so following the Swift-YouTube-Player example correct this part adding the origin parameter:
Swift-YouTube-Player/YouTubePlayerExample/YouTubePlayerExample/ViewController.swift
#IBAction func loadVideo(sender: UIButton) {
playerView.playerVars = [
"playsinline": "1",
"controls": "0",
"showinfo": "0",
"origin": "https://www.youtube.com"
]
playerView.loadVideoID("wQg3bXrVLtg")
}
If you add this parameter the framework avoid to use a blank page as source origin of the streaming and use your value, infact if you take a look to the official sources:
YTPlayerView.m
if (![playerVars objectForKey:#"origin"]) {
self.originURL = [NSURL URLWithString:#"about:blank"];
} else {
self.originURL = [NSURL URLWithString: [playerVars objectForKey:#"origin"]];
}
Now you should have a message like:
"This video contains content from FIFA, who has blocked it from display on this website or application. Watch on YouTube"
Reading the Youtube API docs you can put also http://example.com as value:
where searching for enablejsapi you will find:
Unfortunately,speaking about the YT iOS framework you can search this parameter but you'll find that it's already setted to 1 inside the file player.js and if you'll try to set it inside the playerVars nothing it will happen.
So it's remain (for now..) an Youtube iOS framework bug, probably not properly a bug but YT staff should add to their policies another rule for the iOS content flux, same thing maded for VEVO and a part of UMG content if I remember (and there are also other bugs yet unresolved..)

how does the "#" location tag work?

for better understanding check out this link first: http://sxsw.usehipster.com/questions/where-are-the-best-breakfast-tacos-in-austin
as you can see there, some answers have a reference to a location which is show on the map on the right. A user can do that by adding the “#“ symbol before the location name.
I'd like to know how that works. Did the guys from usehipster.com developed that by themselve or is that maybe a framework I can use too?
cheers
Looks custom-made - i.e. not a framework. Shouldn't be too hard - just scan the entry for #\w+, plug that into Google Local Search (possibly specify the city), and plug the output into a Google Map. See e.g. this for an example of Google Local Search API: http://code.google.com/apis/ajax/playground/?exp=localsearch#the_hello_world_of_local_search

Map app in iphone 4.1

I ran map application(built in) in iphone 4.1.when i give, for example "shops in new york", it shows in map with annotations of all shops.i hope it handles xml file through google URL.anybody knows that url to implement in my aplication?Needs URL for csv response or xml response with multiple latitude and longitiude values, u have given direct URL.
'Shops in New York' seems to be a predefined query that Google Maps accepts.
You can issue within a standard browser using
http://maps.google.com/maps?q="shops in new york"
I'm not sure if this is the problem you are trying to solve, however - feel free to provide some more detail and we'll see if we can figure it out.
Gemma

Discovering the user's first and last names?

I am trying to programmatically discover the first and last names of the iPhone user. Is this possible at all? Calling this ...
getpwuid( getuid() )->pw_gecos == "Mobile User"
..alas. Iterating over the address book finds all address book records, but doesn't distinguish between the device owner and anyone else (that I can tell).
Given that the Mac desktop address book decorates the owners icon with a 'me' overlay in the bottom-left, I'm hoping that sort of information is available in the iPhone version.
Martin.
As noted in the other thread, there is NSFullUserName() - this call does come up in the iPhone documentation so it should work on the device. Simply parse out the first and last name from that.
See similar question - there is no public API for that.