开发

扫码

1.1 协议名

BBASMScanCodeAdapterProtocol

1.2 功能说明

扫描二维码功能(与扫码打开小程序无关),宿主需实现此功能,将扫描得到的结果、二维码的类型以回调的形式返回给小程序内部。
扫码 API 文档

1.3 接口列表

1
2
3
4
5
/**
* @brief 扫码
* @param callBack 扫码成功回调,result为"码的内容字符串",type为TMNPBarcodeType
*/
+ (void)scanCode:(void(^)(NSString *result,TMNPBarcodeType type))callBack;

小程序二维码类型:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  typedef enum TMNPBarcodeType : NSInteger
{
EMNPBarcodeType_NONE = 0, /*no symbol decoded */
EMNPBarcodeType_EAN8 = 1,
EMNPBarcodeType_UPCE = 2, /**< UPC-E */
EMNPBarcodeType_ISBN10 = 3, /**< ISBN-10 */
EMNPBarcodeType_UPCA = 4, /**< UPC-A */
EMNPBarcodeType_EAN13 = 5, /**< EAN-13 */
EMNPBarcodeType_ISBN13 = 6, /**< ISBN-13 */
EMNPBarcodeType_I25 = 7, /**< Interleaved 2 of 5 */
EMNPBarcodeType_CODE39 = 8, /**< Code 39*/
EMNPBarcodeType_CODE128 = 9, /**< Code 128 */
EMNPBarcodeType_QRCODE = 10, /**< QR Code*/
EMNPBarcodeType_MATRIXCODE = 11,
EMNPBarcodeType_AZTECCODE = 12
}TMNPBarcodeType;

1.4 示例

参考:BBASMScanCodeImplement