ios - Zebra imz320 zpl bluetooth printer "ZSDK_API_ERROR_DOMAIN" - code: 1 error -
i trying make extension on ios app zebra imz320 printer. followed developers guide of zebra. ı got error sdk.
here code:
- (ibaction)buttonpressed:(id)sender { nsstring *serialnumber = @""; //find zebra bluetooth accessory eaaccessorymanager *sam = [eaaccessorymanager sharedaccessorymanager]; nsarray * connectedaccessories = [sam connectedaccessories]; (eaaccessory *accessory in connectedaccessories) { if([accessory.protocolstrings indexofobject:@"com.zebra.rawport"] != nsnotfound){ serialnumber = accessory.serialnumber; break; //note: find first printer connected! if have multiple zebra printers connected, should display list user , have him select 1 wish use } } // instantiate connection zebra bluetooth accessory id<zebraprinterconnection, nsobject> theprinterconn = [[mfibtprinterconnection alloc] initwithserialnumber:serialnumber]; // open connection - physical connection established here. bool success = [theprinterconn open]; // example prints "this zpl test." near top of label. nsstring *zpldata = @"^xa^fo20,20^a0n,25,25^fdthis zpl test.^fs^xz"; nserror *error = nil; // send data printer byte array. success = success && [theprinterconn write:[zpldata datausingencoding:nsutf8stringencoding] error:&error]; if (success != yes || error != nil) { uialertview *erroralert = [[uialertview alloc] initwithtitle:@"error" message:[error localizeddescription] delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [erroralert show]; }
}
however when try print got error last nserror
variable. in write function.
domain: "zsdk_api_error_domain" - code: 1
can help? in advance.
try using zebra-toolkit. save lot of trouble managing printer , using zpl.
Comments
Post a Comment