What is, and how would I create a URL scheme for use in an iOS API?

To integrate my iOS app into the Square point of sale app, I am required to specify a URL scheme in the URL Types in the Info tab of General settings in Xcode.


I have no idea what to specify. Seems it will be used so the Square app can return to my app after it does its processing.


Any help would be appreciated, thanks!

Replies

May be this will help:

The scheme, consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. It is followed by a colon (:). Examples of popular schemes include http(s), ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.


h ttps://en.wikipedia.org/wiki/Uniform_Resource_Identifier

Thank you!


So would something like "chiromaster-url-scheme" be appropriate? Or is it vulnerable somehow?


This is for a Square Point of sale payment app.


Thanks again!

I cannot tell about it.


https at least for sure, with strong encryption. Don't you get information on their site ?

So would something like "chiromaster-url-scheme" be appropriate?

It’s a good start. You definitely want to include the name of your product, which will prevent folks from accidentally reusing the scheme. However, adding

-url-scheme
is pointless because that’s implicit in the context.

Beyond that I agree with Claude31 here: You should see if Square has specific guidance on this topic.

WARNING iOS provides no mechanism to ‘vet’ URL schemes. You might declare a custom scheme so that Square can return to your app, but any other app might open a URL with that scheme. If you encode any data in your URL, you must securely parse that data. Failure to do so could result in a malicious app doing bad things.

Note URL schemes are officially registered by IANA, although the vast majority of schemes used by developers are not )-:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"