AppClip codes with query string params
Recently I’ve been doing some AppClip development and investigation. I personally believe that AppClips are very cool and have the potential to be very useful. One of the limitations of AppClips is the fact that one AppClip target is available per application. So if you want to support multiple experiences, you certainly can, you just need to supply your AppClip with different parameters via query string. Much like you’d do on the web.
An invocation URL might look like this:and that would direct you to an experience in an AppClip. Another invocation URL might look like this: which could direct you to another function in the AppClip. You can use a traditional looking QR code to invoke the AppClip, but Apple offers a command line interface for their AppClipCodeGenerator tool you can download from their developer tools area.
I ran into a problem that wasn’t really described and I’ll document the solution here in case you bump into this yourself. From the Terminal, this is a typical input sequence:
% AppClipCodeGenerator generate --url https://ericd.net/?id=123 --index 9 --output ~/Desktop/filename.svg --type nfc
However, using that will produce an error: zsh: no matches found: https://ericd.net/?id=123.
The tool doesn’t like that query string. You need to escape that ? character with a \. So this will work:
% AppClipCodeGenerator generate --url https://ericd.net/\?id=123 --index 9 --output ~/Desktop/filename.svg
App Clip Code successfully generated.