QRCode encoding a simple string in ios

2019-05-10 14:15发布

问题:

I have downloaded a sample code from github for QRCode encoding.

It works fine and generates an image with QRCode for string that I specified.

But, when I scan that image, it displays the string like http://mystring.

I need only mystring. How to do that? Is the problem is with QRscanner app?

I think the QRencoderapp is about encoding an url.

Is there any other sample to encode just a simple string (not url)?

or

Is there any changes to be done get the string instead of url in the above code?

回答1:

I 've solved my problem.

I downloaded a project from this Github link.

The code in that prjct creates a QRCode image for a simple text.

NSString *code = @"Our String to be encoded";

Barcode *barcode = [[Barcode alloc] init];

self.view.backgroundColor = [UIColor whiteColor];

[barcode setupQRCode:code];

ourImageView.image = barcode.qRBarcode;

Hope, this will help others.