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:
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.
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:
Causes a memory problem for large strings as described by others. So then instead we need to call to other function:
... 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; {
}
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.