AbobosSoftware / cordova-plugin-brother-label-printer

Cordova and Capacitor plugin for Bother Label Printers
MIT License
10 stars 16 forks source link

Unable to install plugin #39

Closed samoka closed 1 year ago

samoka commented 2 years ago

Anyone else having this issue?

Cannot find framework "/plugins/cordova-plugin-brother-label-printer/src/ios/libs/BRPtouchPrinterKit.framework" for plugin cordova-plugin-brother-label-printer in iOS platform

robr2112 commented 2 years ago

The SDK used with this plugin was recently updated to the new v4, which is now named "BRLMPrinterKit.framework".

samoka commented 2 years ago

I do see that in the libs directory, just not sure while "cordova build ios" is looking for that specific SDK. :(

arcadius commented 2 years ago

Hello @samoka , please make sure you fully uninstall the old version of the plugin ... and possibly, remove ios and re add ios

samoka commented 2 years ago

Did that multiple times already, even uninstalled the plugin removed all platforms, re installed the plugin and added back the platforms. Android installs with no issue, just iOS that comes up with that error.

samoka commented 2 years ago

Or maybe there are some files somewhere that I still need to clean up 🤷🏿‍♂️

arcadius commented 2 years ago

@samoka , please search your codebase for any reference to BRPtouchPrinterKit

I am happy to have a conf call with you to look at this issue

samoka commented 2 years ago

@arcadius thanks so much for the offer, I will do a codebase search and come back to you with findings ASAP

samoka commented 2 years ago

@arcadius might need to take you up on the conf call offer, not making any progress.

samoka commented 2 years ago

@arcadius I see you posted a fix, thanks for that, but looks like we still have some places where BRPtouchPrinterKit is still being imported, e.g BRWLANPrintOperation.h, so building iOS throws an error.

arcadius commented 2 years ago

Yes, I know .... looking into it

arcadius commented 2 years ago

@samoka , please cordova plugin rm cordova-plugin-brother-label-printer --save

cordova plugin add cordova-plugin-brother-label-printer --save

Then build your cordova project. The build will fail on iOS.

1- You then need to open XCode. 2- Click on your project in the target 3- then "General" tab and under General tab ... scroll under "Frameworks, Libraries, and Embedded content" 4- Change the "embed" column to "Embed & Sign" as shown in screenshot below

Screenshot 2021-06-17 at 02 35 59

Then you can build with xcode and publish without any issue. Please have a go

samoka commented 2 years ago

@arcadius Awesome, will give feedback shortly.

samoka commented 2 years ago

Ok just tried and got the below, also when adding plugin it didn't automatically add the framework i had to add the framework manually, not sure if that might have contributed to this issue? Screenshot at Jun 17 08-16-48

Screenshot at Jun 17 08-19-02

arcadius commented 2 years ago

@samoka , that one is a separate issue ... In "architecture" you need to choose : build for active architecture only=YES

More at https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios

samoka commented 2 years ago

@arcadius ok, will create a blank fresh project just to test this out, my current one seems to have gotten itself into a knot. Will let you know once I have tested so we can mark this as resolved :)

samoka commented 2 years ago

Managed to get it to work on a clean project, so we can mark this as resolved. Thanks @arcadius

With regards to the architecture issue after googling around finally got a fix that worked for me.

Screenshot at Jun 17 12-36-15

robr2112 commented 2 years ago

@samoka , yes, setting "Validate Workspace" is the correct "workaround" solution for the issue you mentioned. Note that you should now be able to change this back to "No" to eliminate the warning, if you wish. Xcode 12.3 just needs to add this setting to the project, which setting to "Yes" causes (but also now generates a warning).

The solution that @arcadius mentioned will solve a different problem: "building for iOS Simulator, but linking in Dylib built for iOS". This will occur on Intel Mac when building for Simulator in Release configuration (i.e. "Build for Active Architecture Only" will be set to yes, causing Xcode to generate a UB for simulator which includes "arm64" for M1 processor). If you build for Simulator on M1 Mac, this will occur in BOTH "Debug" and "Release" configurations. The solution in each case is the same, if you run into it: Modify "Excluded Architectures" to exclude "arm64" when building for "Any iOS Simulator SDK"...in either or both Debug and Release configurations. On M1, Xcode will build for "x86_64" instead of "arm64" when attempting to run on the M1 simulator (which presumably will then run successfully under Rosetta).

IMPORTANT NOTE: When you are ready to upload the app to the AppStore, you will run into another problem, because SDK framework lib that is now "embedded" inside the app IPA will contain both Simulator and Device processor slices in the UB (Universal Binary). It will be necessary to remove simulator processors from this framework LIB, because Apple will not allow anything containing simulator processors to be uploaded to AppStoreConnect.

I recommend adding a RunScript to Build Phases. You may see some examples here: https://stackoverflow.com/questions/30547283/submit-to-app-store-issues-unsupported-architecture-x86

I've had good success adapting Michael Radinov's comment to Varrry's accepted answer.

Ultimately, the best solution to all of these issues will be to convert the SDK framework to an "xcframework". This will likely be coming in a future SDK release. So, keep an eye out for these future SDK releases.

-Rob

arcadius commented 1 year ago

Closing this as @samoka managed to get it working

robr2112 commented 1 year ago

FYI, the iOS SDK is now distributed as an "xcframework" as of SDK v4.5.1.

So, that should resolve many of these build errors and warnings that began with Xcode12.

-Rob