another_brother icon indicating copy to clipboard operation
another_brother copied to clipboard

iOS printing not working

Open izhaanx1 opened this issue 1 year ago • 6 comments

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), ), ); } }

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
<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

izhaanx1 avatar Jul 18 '23 15:07 izhaanx1

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,

CodeMinion avatar Jul 19 '23 13:07 CodeMinion

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 avatar Jul 19 '23 14:07 izhaanx1

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

izhaanx1 avatar Jul 19 '23 14:07 izhaanx1

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,

CodeMinion avatar Jul 19 '23 14:07 CodeMinion

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

izhaanx1 avatar Jul 19 '23 15:07 izhaanx1

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

CodeMinion avatar Jul 19 '23 17:07 CodeMinion