Is there a way to generate QR code image on iOS

user1561181 picture user1561181 · Aug 21, 2012 · Viewed 36.7k times · Source

Is there a standard way to generate a QR code and attach it to a mail item from iOS client app (no server code)?

Answer

quarac picture quarac · Mar 10, 2014

Since iOS 7, you can use a Core Image filter to generate QR images. See the final tip here:

- (CIImage *)createQRForString:(NSString *)qrString {
    NSData *stringData = [qrString dataUsingEncoding: NSISOLatin1StringEncoding];

    CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
    [qrFilter setValue:stringData forKey:@"inputMessage"];

    return qrFilter.outputImage;
}