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

醉酒当歌 提交于 2019-12-07 13:30:45

问题


I did qr code with Zxing, Right now I can read data but what I want is :

  • Example: Be able read type of QR Code is wifi, VCard, Calendar, url, etc... if detect QR Code is wifi so I be able code to change wifi setting key,

So, how do i know that data read from QR code is wifi?


回答1:


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.




回答2:


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.




回答3:


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 :/



来源:https://stackoverflow.com/questions/7886764/objective-c-is-it-possible-to-detect-qr-code-data-type

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