Objective-C : is it possible to detect QR code data type?

这一生的挚爱 提交于 2019-12-06 02:44:57

QR Code itself does not specify any types. Its plain text. It can be an HTTP URL or a custom URL. (e.g. it should have "type://wifi" inside it. You can then use it to see what the type is). But off-the-shelf, there is no such thing. You have to know who is creating the QR Codes and what is he storing in them.

There is no standard format for encoding wi-fi information in a QR code. There is a de facto standard suggested by zxing and supported by Barcode Scanner, which is like:

WIFI:T:WPA;S:mynetwork;P:mypass;;

(This imitates many of DoCoMo's standards for QR code contents.) I'd just reuse this if you can.

This page lists common encodings for other data. Whether you can do anything with them on the iPhone, I don't know. On Android you can scan these to configure Wi-fi and add contacts.

Here is a nice document of different QR code types. None of them are standard, but you get the idea: https://github.com/zxing/zxing/wiki/Barcode-Contents

There is platform specific format for Android.

    WIFI:T:WPA;S:mynetwork;P:mypass;;

Though, if there is no API for setting the WIFI settings on iOS, any format doesn't help much :/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!