0

Now I generate QR Code with simple text and for that I use below demo project.
IOS_QR_Code_Generator

And for generating QR code:

 NSString *code = @"JAY RAPARKA SIMPLE Encoding string";

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

 self.view.backgroundColor = [UIColor whiteColor];

 [barcode setupQRCode:code];
 ivQRCode.image = barcode.qRBarcode;

Right now I just encode "JAY RAPARKA SIMPLE Encoding string" this simple text but I want to generate QR code for more complex data like (Contect information, link/URL, account balance on the base of id,etc..). So please any one done this earlier than please help me.

Thank you!

For decoding I use ZBar sdk and it also works properly and encoding also work but I just want to generate QR for more data.

2 Answers 2

2

You can create contact information by giving text in bellow format

BEGIN:VCARD
VERSION:2.1
N:;Company Name
FN:Company Name
ORG:Company Name
TEL;WORK;VOICE;PREF:+16045551212
TEL;WORK;FAX:+16045551213
ADR;WORK;POSTAL;PARCEL;DOM;PREF:;;123 main street;vancouver;bc;v0v0v0;canada
EMAIL;INTERNET;PREF:[email protected]
URL;WORK;PREF:http://www.example.com/
NOTE:http://www.example.com/
CATEGORIES:BUSINESS,WORK
UID:A64440FC-6545-11E0-B7A1-3214E0D72085
REV:20110412165200
END:VCARD
Sign up to request clarification or add additional context in comments.

1 Comment

this idea is cool but in ios we can not create VCARD like this.so i can't accept your answer.sorry!
0

You can use this code

- (NSString *)vCardRepresentation
{
  NSMutableArray *mutableArray = [[NSMutableArray alloc] init];

  [mutableArray addObject:@"BEGIN:VCARD"];
  [mutableArray addObject:@"VERSION:3.0"];

  [mutableArray addObject:[NSString stringWithFormat:@"FN:%@", self.name]];

  [mutableArray addObject:[NSString stringWithFormat:@"ADR:;;%@",
                       [self addressWithSeparator:@";"]]];

  if (self.phone != nil)
  {
    [mutableArray addObject:[NSString stringWithFormat:@"TEL:%@", self.phone]];
  }

  [mutableArray addObject:[NSString stringWithFormat:@"GEO:%g;%g",
                       self.latitudeValue, self.longitudeValue]];

  [mutableArray addObject:[NSString stringWithFormat:@"URL:http://%@",
                       self.website]];

  [mutableArray addObject:@"END:VCARD"];

  NSString *string = [mutableArray componentsJoinedByString:@"\n"];

  [mutableArray release];

  return string;
}

OR you can generate String with saparator like,

NSString *str = "Name : Jay, Work : IOSDeveloper";

and after that saperate this using

NSArray *ary = [mystring componentsSeparatedByString:@","];

now you can use this ary with index.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.