1

I am trying to integrate socketscan SDK with my objective C iOS app. I downloaded scanapisdk, made a copy of scanapisdk inside my project main folder. I Added the files and library references to the Xcode project. compiled and build the app. run it on a device. The following code has been working with no problem for couple of years now.

I have a constant NSString declared as global variable in an m file

NSString *const kSymbology = @"Symbology";

and it is declared as an extern in an h file

extern NSString *const kSymbology;

Then in a database class there is this code fragment

NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
const char *Symbology = (const char*)sqlite3_column_text(statement, 0);
strSymbology = [NSString stringWithUTF8String:Symbology];

[dict setValue:strSymbology forKey:kSymbology];
[symbologies addObject:dict];
[dict release];

The code crashes on this line [dict setValue:strSymbology forKey:kSymbology];

When I change it to [dict setValue:strSymbologyAlias forKey:@"Symbology"]; The app doesn't crash.

It doesn't make sense to me. it seems that the error is somewhere else and it is showing here by accident. The only new thing I have added to my project are the references to the socketScan files and libraries. I don't even call any of the methods in the SDK. I commented out all the methods in ScanApiHelper.mm file, now the app doesn't crash. I started to put back some of the methods in ScanApiHelper.mm and I discovered that when any line that has SktClassFactory mentioned for example (for example [SktClassFactory createScanObject]) is alive, the app crashes.

Can that be related to not using CocoaPods to install the sdk?

AyPro
  • 21
  • 4

1 Answers1

1

It looks like a name space collision. The libScanApiCore.a has a variable named kSymbology and my global variable is also named kSymbology. Once I changed the variable name to ksymbology (lower case s) my app no longer crashes.

AyPro
  • 21
  • 4