ios - Zebra bluetooth printer only working under debugger -
i printing qln420 , it's working great under debugger or when small amounts of zpl passed fails when run app not under debugger. code same zebra's demo code (https://km.zebra.com/kb/index?page=content&id=wh122&actp=list) except dispatch_async performed earlier in callstack.
nsstring *serialnumber = [zebraprintmanager getbluetoothserial]; // instantiate connection zebra bluetooth accessory id<zebraprinterconnection, nsobject> theprinterconn = [[mfibtprinterconnection alloc] initwithserialnumber:serialnumber]; // open connection - physical connection established here. bool success = [theprinterconn open]; nserror *error = nil; // send data printer byte array. nsdata* data = [zpl datausingencoding:nsutf8stringencoding]; success = success && [theprinterconn write:data error:&error]; dispatch_async(dispatch_get_main_queue(), ^{ if(success != yes || error != nil) { uialertview *erroralert = [[uialertview alloc] initwithtitle:@"error" message:[error localizeddescription] delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [erroralert show]; } }); // close connection release resources. [theprinterconn close];
there delay setting bluetooth. increase @ least 100. phones not capable of using value set 30.
Comments
Post a Comment