another_brother
another_brother copied to clipboard
iOS printing not working
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<BluetoothPrinter> 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), ), ); } }
<key>NSCameraUsageDescription</key>
<string>Camera is required to capture Visitor Image</string>
<key>NSMicrophoneUsageDescription</key>
<string>your usage description here</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocalNetworkUsageDescription</key>
<string>Looking for local tcp Bonjour service</string>
<key>NSBonjourServices</key>
<array>
<string>_ipp._tcp</string>
<string>_printer._tcp</string>
<string>_pdl-datastream._tcp</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notifications</string>
</array>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Need BLE permission</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Need BLE permission</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Need Location permission</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Need Location permission</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Need Location permission</string>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.brother.ptcbp</string>
<string>com.issc.datapath</string>
</array>
<!-- End Another Brother Section -->
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
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,
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
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
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,
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
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