GithubHelp home page GithubHelp logo

objqrencoder's Introduction

Objective C QR Encoder

This repository contains an open source Objective C QR Encoder licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

Ported from http://github.com/whomwah/rqrcode by Bill Jacobs.

Adding the QR Encoder to your project

The QR Encoder is compiled as a static library, and the easiest way to add it to your project is to use Xcode's "dependent project" facilities. Here is how:

  1. Clone the ObjQR git repository: git clone git://github.com/jverkoey/objqr.git. Make sure you store the repository in a permanent place because Xcode will need to reference the files every time you compile your project.

  2. Locate the "QREncoder.xcodeproj" file under "objqr/src/". Drag QREncoder.xcodeproj and drop it onto the root of your Xcode project's "Groups and Files" sidebar. A dialog will appear -- make sure "Copy items" is unchecked and "Reference Type" is "Relative to Project" before clicking "Add".

  3. Now you need to link the QREncoder static library to your project. Click the "QREncoder.xcodeproj" item that has just been added to the sidebar. Under the "Details" table, you will see a single item: libQREncoder.a. Check the checkbox on the far right of libQREncoder.a.

  4. Now you need to add QREncoder as a dependency of your project so that Xcode compiles it whenever you compile your project. Expand the "Targets" section of the sidebar and double-click your application's target. Under the "General" tab you will see a "Direct Dependencies" section. Click the "+" button, select "QREncoder", and click "Add Target".

  5. Finally, we need to tell your project where to find the QREncoder headers. Open your "Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click it. Add the relative path from your project's directory to the "objqr/src/Classes" directory.

  6. You're ready to go. Just #import "QREncoder/QREncoder.h" anywhere you want to use QREncoder classes in your project.

Example QR Output

google.com

objqrencoder's People

Contributors

jverkoey avatar marcuswestin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

objqrencoder's Issues

Encode free-form text instead of URL

I'm not sure if this is a string size or property settings issue, but when I try to encode a free-form text string (instead of a URL) nothing displays. Is there a property setting that determines the type of QR code?

  • Calendar Event
  • Contact Information
  • Email Address
  • Geo Location
  • Phone #
  • SMS
  • Text
  • URL

Thanks

Very weird behavior on a concrete input string

We've experinced a weird behaviour while encoding the following string: @"150#128091007#https://m.citysoft.kz:85/".
None of QR readers suceeded to read the generated QR code.
If we change ANYTHING (a numeral, domain name, port or slash in the end) - we get a valid QR code.

150#128091007#https://m.citysoft.kz:85 - works
150#128091007#https://m.google.kz:85/ - works
150#128091008#https://m.citysoft.kz:85/ - works
150#128091007#https://m.citysoft.kz/ - works
150#128091007#https://m.citysoft.kz:85/ - does not work
(checked on QRUI example project)

However, if we modify [QREncoder encode:] method and use QRCorrectionLevelMedium instead of QRCorrectionLevelHight - everything is OK again.

add url to QR

hi,

i'm develop a iPhone app . that need the QRencode
the url is like understand url.
http://testurl.com/test?a=2.0&d=Test

but i can't encode string
i have try 2 kind of codes

    UIImage*image2 = [QREncoder encode:SetupLink size:64 correctionLevel:QRCorrectionLevelLow];

and
//UIImage* image = [QREncoder encode:SetupLink];

do i something wrong ?

thx
wim

36 Character Limit?

Hi, great project!

When I am trying to encode a string of more than 36 characters, I gets a "code overflow" and returns nil.

Is there a way to increase the capacity?

Thx
Daniel

Issues with Encoding large strings and size/correction params

I am also finding the same issues as many other people when the strings for encoding becomes large... using the parameters of size/correction level does not solve the problem.

Firstly, using the default function:

  • (UIImage *)encode:(NSString *)str;

Causes a memory problem for large strings as described by others. So then instead we need to call to other function:

  • (UIImage *)encode:(NSString *)str size:(int)size correctionLevel:(QRCorrectionLevel)level;

... which allows you to put in size and correction level.

However, the library does not seem to work using the QR spec for how many chars you can code with qr version/correction level as specified here:
http://www.denso-wave.com/qrcode/vertable1-e.html

So, no problem we can write our own function which can tell you what version number to go for for QR correction level LOW to avoid the memory exception:

+(int) genSize:(NSString *) myString; {

int version = 4;

if ([myString length] > 0 && [myString length] <19){
    version=2;
}

if ([myString length] >= 20 && [myString length] <33){
    version=2;
}

if ([myString length] >= 34 && [myString length] <54){
    version=3;
}

if ([myString length] >= 55 && [myString length] <79){
    version=4;
}

if ([myString length] > 80 && [myString length] <107){
    version=5;
}

if ([myString length] >= 108 && [myString length] <135){
    version=6;
}

if ([myString length] >= 136 && [myString length] <155){
    version=9;
}

if ([myString length] >= 156 && [myString length] <193){
    version=9;
}

return version;

}

Now there are no memory errors and you always get an image being output even for larger (100+ char) strings, however the image is often corrupt and not scannable by any QR decoder :(

Any help appretiated if I'm doing something wrong.

Are these QRCodes valid?

I've been scanning the QRCodes generated by this library, and my scanner is not reading them.

It has no problem with the QRCodes generated by Google Charts API

Error generating QRCode images on iPhone6

We use your pod for some time now and everything's working fine. But when using iphone 6, so 64Bit systems, we got errors creating an QRCode from string .

Problem is in QREncoder.m line 416 "encode:size:correctionLevel"

The current code is:

int minLostPoint = LONG_MAX;

but on iPhone 6 (64Bit systems) LONG_MAX is giving a higher value than int can store and minLostPoint is turning to -1.
If we correct the line to:

long int minLostPoint = LONG_MAX;

everything's working as expected.

Long strings encoding

Hello!
Could you explain how use this Encoder correctly with long strings?
I've try something like

for(int i=4; i<12;i++)
{
image = [QREncoder encode:link size:i correctionLevel:QRCorrectionLevelHigh];
if(image != nil)
{
NSLog(@"%d %p",i, image);
break;
}
}
but result can't be decoded by different decoders when i=8, and crash if string a bit longer:
"Project (720,0xa0597500) malloc: *** error for object 0x6050004: incorrect checksum for freed object - object was probably modified after being freed."

I've try to set size=12 for each input, but result can't be decoded too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.