Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with MacOS while building #154

Closed
A7MeDG0L0L opened this issue Jul 16, 2022 · 13 comments
Closed

Error with MacOS while building #154

A7MeDG0L0L opened this issue Jul 16, 2022 · 13 comments

Comments

@A7MeDG0L0L
Copy link

A7MeDG0L0L commented Jul 16, 2022

flutter/.pub-cache/hosted/pub.dartlang.org/blue_thermal_printer-1.2.2/macos/Classes/SwiftBlueThermalPrinterPlugin.swift:9:17: error: cannot find 'Music' in scope
let music = Music(messenger: registrar.messenger, registrar: registrar)
^~~~~

@utpalruparel
Copy link

'FlutterBinaryMessenger'
let channel = FlutterMethodChannel(name: "blue_thermal_printer", binaryMessenger: registrar.messenger())
^ ~~
1.2.3/macos/Classes/SwiftBlueThermalPrinterPlugin.swift:14:21: error: cannot find 'UIDevice' in scope
result("iOS " + UIDevice.current.systemVersion)
^~~~~~~~
** BUILD FAILED **

@A7MeDG0L0L
Copy link
Author

A7MeDG0L0L commented Jul 31, 2022

After Update to 1.2.3

Launching lib/main.dart on macOS in debug mode...
Building macOS application...
../blue_thermal_printer-1.2.3/macos/Classes/BlueThermalPrinterPlugin.m:6:4: error: unknown receiver 'SwiftBlueThermalPrinterPlugin'; did you mean 'BlueThermalPrinterPlugin'?
  [SwiftBlueThermalPrinterPlugin registerWithRegistrar:registrar];
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   BlueThermalPrinterPlugin
In file included from ../blue_thermal_printer-1.2.3/macos/Classes/BlueThermalPrinterPlugin.m:1:
@interface BlueThermalPrinterPlugin : NSObject<FlutterPlugin>
           ^
1 error generated.
** BUILD FAILED **

Exception: Build process failed

@flutter-painter
Copy link
Contributor

Hi @A7MeDG0L0L,

I added those files to be able to build app on macos,
I have no exeprience in making a flutter package for macos so i trimmed files found in just audio package to trick pod ;
hence the AssetsAudioPlayer reference in .swift file

This works on my mac,
What error do you get if you try to build macos version of blue_thermal_printer/example ?

@A7MeDG0L0L
Copy link
Author

A7MeDG0L0L commented Sep 11, 2022

Hi @A7MeDG0L0L,

I added those files to be able to build app on macos, I have no exeprience in making a flutter package for macos so i trimmed files found in just audio package to trick pod ; hence the AssetsAudioPlayer reference in .swift file

This works on my mac, What error do you get if you try to build macos version of blue_thermal_printer/example ?

Hi @flutter-painter
as I mention above that I get when build example
I tried again and got same error

`/Users/ahmedgalal/StudioProjects/blue_thermal_printer/macos/Classes/BlueThermalPrinterPlugin.m:6:4: error: unknown receiver 'SwiftBlueThermalPrinterPlugin'; did you mean 'BlueThermalPrinterPlugin'?
[SwiftBlueThermalPrinterPlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BlueThermalPrinterPlugin
In file included from /Users/ahmedgalal/StudioProjects/blue_thermal_printer/macos/Classes/BlueThermalPrinterPlugin.m:1:
@interface BlueThermalPrinterPlugin : NSObject
^
1 error generated.
** BUILD FAILED **

Exception: Build process failed
`

@A7MeDG0L0L A7MeDG0L0L changed the title Error with Macos while building Error with MacOS while building Sep 11, 2022
@A7MeDG0L0L
Copy link
Author

@flutter-painter Can you tell me which files you tirmmed from JustAudio package
and where you put these files into that package ?

@flutter-painter
Copy link
Contributor

Hi @A7MeDG0L0L

The three classes are here :
macos/

I also reworked a typo in the podspec
macos/blue_thermal_printer.podspec

@A7MeDG0L0L
Copy link
Author

@flutter-painter
Can you create a new fork with your changes to use it because I didn't understand which files from JustAudio/macos
Or JustAudio/example/macos
Thanks in advance

@flutter-painter
Copy link
Contributor

flutter-painter commented Sep 12, 2022

You should not need to add anyhting else,
I was just providing context to the peculiar look of the /macos folder in this package.

It works without any edits from the latest version of blue_thermal_printer
I am sure you tried to run : flutter clean

But did you also remove all versions of blue_thermal_printer from your .pub-cache ?
It should be here : flutter/.pub-cache/hosted/

@A7MeDG0L0L
Copy link
Author

@flutter-painter
Currently I cloned this repo and run example
but can you explain to me what you did with these three classes (Removed / Copied from another source / edited)
image

@flutter-painter
Copy link
Contributor

You are right I think I changed locally in BlueThermalPrinterPlugin.m

SwiftBlueThermalPrinterPlugin -> BlueThermalPrinterPlugin

I have issues building at the moment so I cannot test and PR, but it should fix it for you

@A7MeDG0L0L
Copy link
Author

You are right I think I changed locally in BlueThermalPrinterPlugin.m

SwiftBlueThermalPrinterPlugin -> BlueThermalPrinterPlugin

I have issues building at the moment so I cannot test and PR, but it should fix it for you

By Changing that it failed to build.
image

@flutter-painter
Copy link
Contributor

flutter-painter commented Sep 18, 2022

Hi @A7MeDG0L0L,

Thank you for trying it out and sorry for the trouble, I messed around with the macos files again and straightened it out.
PR submitted here :

#169

  • remove the swift file

  • update the content of the .m with

#import "BlueThermalPrinterPlugin.h"

static NSString *const CHANNEL_NAME = @"plugins.kzaki.com/blue_thermal_printer";


@implementation BlueThermalPrinterPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
    FlutterMethodChannel* channel = [FlutterMethodChannel
                                     methodChannelWithName:CHANNEL_NAME
                                     binaryMessenger:[registrar messenger]];
    BlueThermalPrinterPlugin* instance = [[BlueThermalPrinterPlugin alloc] init];
    [registrar addMethodCallDelegate:instance channel:channel];
}

@end

// note reformatting this to ease copy paste
@kakzaki if you could generate a new version of blue_thermal_printer (^1.2.4) it would be much appreciated

@A7MeDG0L0L
Copy link
Author

@flutter-painter Thanks alot your branch works well. and it merged but I wait it to push into pub.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants