ekasetiawans / flutter_bluetooth_printer_plugin

MIT License
21 stars 36 forks source link

iOS Build error #10

Closed fahami closed 1 year ago

fahami commented 1 year ago

I work on example project that available in this repository. When I debug to iOS device, it failed showing this error.

Running pod install...
Running Xcode build...
Xcode build done.                                            7.6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/kw/ckbfnc91223b1yyc3q6rkpyr0000gn/T/flutter_tools.hiYTEE/flutter_ios_build_temp_dirkhrjfP/temporary_xcresult_bundle

    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:85:34: error: 'CBManagerState' is only available in iOS 10.0 or newer
        public var didInitialized: ((CBManagerState) -> ())?
                                     ^
    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:73:14: note: add @available attribute to enclosing class
    public class BluetoothPrinterManager {
                 ^
    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:106:76: error: 'CBManagerState' is only available in iOS 10.0 or newer
        public init(delegate: PrinterManagerDelegate? = nil, didInitialized: ((CBManagerState) -> ())? = nil) {
                                                                               ^
    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:106:12: note: add @available attribute to enclosing initializer
        public init(delegate: PrinterManagerDelegate? = nil, didInitialized: ((CBManagerState) -> ())? = nil) {
               ^
    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:73:14: note: add @available attribute to enclosing class
    public class BluetoothPrinterManager {
                 ^
    note: Building targets in dependency order
    note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/Runner.app'

    note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/device_info_plus/device_info_plus.framework'

    note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/Pods_Runner.framework'

    note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/flutter_bluetooth_printer/flutter_bluetooth_printer.framework'

    note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/pdfx/pdfx.framework'

    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/example/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'flutter_bluetooth_printer' from project 'Pods')
    warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    /Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/example/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'Flutter' from project 'Pods')

    Result bundle written to path:
        /var/folders/kw/ckbfnc91223b1yyc3q6rkpyr0000gn/T/flutter_tools.hiYTEE/flutter_ios_build_temp_dirkhrjfP/temporary_xcresult_bundle

Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): 'CBManagerState' is only available in iOS 10.0 or newer
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:84:33

Swift Compiler Error (Xcode): 'CBManagerState' is only available in iOS 10.0 or newer
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:105:75

Error launching application on iPhone.

I am using

- Flutter 3.0.3 ``` [✓] Flutter (Channel stable, 3.0.3, on macOS 13.0.1 22A400 darwin-arm, locale en-ID) • Flutter version 3.0.3 at /Users/netscape/fvm/versions/3.0.3 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 676cefaaff (6 months ago), 2022-06-22 11:34:49 -0700 • Engine revision ffe7b86a1e • Dart version 2.17.5 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at /Users/netscape/Library/Android/sdk • Platform android-33, build-tools 33.0.1 • ANDROID_HOME = /Users/netscape/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.74.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.54.0 [✓] Connected device (2 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator) • iPhone (mobile) • 24c3d44539c2cda9be5e1dbe420be0b63ca5a5d7 • ios • iOS 16.1.2 20B110 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
ekasetiawans commented 1 year ago

Change the minimum supported ios version to ios 10