CodeMinion / another_brother

Another Brother Flutter SDK
BSD 3-Clause "New" or "Revised" License
21 stars 19 forks source link

iOS printing not working #56

Open izhaanx1 opened 1 year ago

izhaanx1 commented 1 year ago

i am using another brother package i can print from android but can not print from iOS i have given all the permissions in info.plist file but its not asking for any

attaching my info.plist and print function for your reference

void printBadge(BuildContext context) async { var printer = Printer();

PrinterInfo printerInfo = PrinterInfo(); printerInfo.printerModel = Model.QL_820NWB; printerInfo.printMode = PrintMode.FIT_TO_PAGE; printerInfo.isAutoCut = true; printerInfo.labelNameIndex = QL700.ordinalFromID(QL700.W62.getId()); printerInfo.port = Port.BLUETOOTH;

List printers = await printer.getBluetoothPrinters([Model.QL_820NWB.getName()]); if (printers.isEmpty) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Padding( padding: const EdgeInsets.all(8.0), child: Text("No printers found"), ), )); return; } printerInfo.macAddress = printers.single.macAddress; await printer.setPrinterInfo(printerInfo);

try { await printer.printPdfFile(pdfPath, 1); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('Printing failed: $e'), duration: Duration(seconds: 2), ), ); } }

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

CADisableMinimumFrameDurationOnPhone CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName Visit Me CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName visit_me_flutter CFBundlePackageType APPL CFBundleShortVersionString $(FLUTTER_BUILD_NAME) CFBundleSignature ???? CFBundleVersion $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS NSCameraUsageDescription Camera is required to capture Visitor Image NSMicrophoneUsageDescription your usage description here UIApplicationSupportsIndirectInputEvents UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance NSLocalNetworkUsageDescription Looking for local tcp Bonjour service NSBonjourServices _ipp._tcp _printer._tcp _pdl-datastream._tcp UIBackgroundModes fetch remote-notifications NSBluetoothAlwaysUsageDescription Need BLE permission NSBluetoothPeripheralUsageDescription Need BLE permission NSLocationAlwaysAndWhenInUseUsageDescription Need Location permission NSLocationAlwaysUsageDescription Need Location permission NSLocationWhenInUseUsageDescription Need Location permission UISupportedExternalAccessoryProtocols com.brother.ptcbp com.issc.datapath

Please help me resolve this issue i've been working on it for days and now i am really frustrated on this

as this is working fine on android but not on iOS

CodeMinion commented 1 year ago

Hi @izhaanx1 ,

Thanks for reaching out about this. Could I trouble you to share a bit more details about that iOS device you are trying to print from?

Also you might have done this already, but could you confirm that you also followed the setup steps described here: https://www.youtube.com/watch?v=AcFnd-6hSew

Thanks in advance,

izhaanx1 commented 1 year ago

Hi @izhaanx1 ,

Thanks for reaching out about this. Could I trouble you to share a bit more details about that iOS device you are trying to print from?

Also you might have done this already, but could you confirm that you also followed the setup steps described here: https://www.youtube.com/watch?v=AcFnd-6hSew

Thanks in advance,

yes i have done all these steps described in the video, the device is iphone 7 plus iOS 15.7.7

izhaanx1 commented 1 year ago

i also tried with the demo app and its saying no devices found but the printer is connected with the iPhone plus its asking no permissions

image

CodeMinion commented 1 year ago

Thanks for the extra details @izhaanx1 .

The demo app is very barebones and it doesn't handled granting permissions so it is something you will need to do by hand as in the case of Android.

One thing regarding iOS and Bluetooth is that after printer is paired to the phone, you still need to go into settings and tap the printer so it says "Connected" in order for the Bluetooth discovery to be able to find it.

Could I trouble you confirm if that's the case?

Thanks in advance,

izhaanx1 commented 1 year ago

er for the Bluetooth discovery to be able t

android is working fine in my case and in iOS i have paired my device with printer and yes it says connected but still not asking any permissions or printing

CodeMinion commented 1 year ago

Thanks for the additional details @izhaanx1 .

The demo app won't ask you to grant permissions because it was outside the scope so that explains why you are not seeing any requests. Do you see any logs during your print attempt on iOS that might shed more light.

For adding the permissions check to the sample you may refer to some of the other projects here: https://github.com/CodeMinion/Oleen-Ohana/blob/master/lib/main.dart#L850