januslo / react-native-bluetooth-escpos-printer

React-Native plugin for the bluetooth ESC/POS & TSC printers.
MIT License
351 stars 411 forks source link

Not working on iOS (Build fail) #183

Open usfslk opened 2 years ago

usfslk commented 2 years ago

This app was tested on Android device and it's working fine but on Xcode I am unable to build the release

The error I am having is

../node_modules/react-native-bluetooth-escpos-printer/ios/ZXingObjC-3.2.2/ZXingObjC/client/result/ZXResultParser.m:252:20:

'stringByReplacingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByRemovingPercentEncoding instead, which always uses the recommended UTF-8 encoding.

I have linked the library manually by adding the package to build phases.

Has anybody successfully installed this library on iPhone?

jleandrocampos commented 2 years ago

I installed and it is working, I created the file with the name: "RNBluetoothEscposPrinter.podspec" in node_modules/react-native-bluetooth-escpos-printer folder.

with this content: require "json"

package = JSON.parse(File.read(File.join(dir, "package.json")))

_Pod::Spec.new do |s| s.name = "RNBluetoothEscposPrinter" s.version = package["version"] s.summary = package["description"] s.author = 'januslo' s.homepage = 'https://github.com/januslo/react-native-bluetooth-escpos-printer' s.license = package["license"] s.platform = :ios, "9.0" s.source = { :git => "https://github.com/januslo/react-native-bluetooth-escpos-printer", :tag => "#{s.version}" } s.source_files = "ios/*/.{h,c,m,swift}" s.requiresarc = true s.dependency "React" end

and in the file package.json add: "files": [ "index.js", "android", "ios", "RNBluetoothEscposPrinter.podspec", "!android/build", "!ios/build" ],

usfslk commented 2 years ago

I got this error after updating these 2 files:

[!] Invalid Podfile file: [!] Invalid RNBluetoothEscposPrinter.podspec file: undefined local variable or method `dir' for Pod:Module.

 package = JSON.parse(File.read(File.join(dir, "package.json")))

I cannot run pod install on ios folder and build fails too

EDIT: I managed to fix the previous by changing those lines:

    package = JSON.parse(File.read(File.join('../../', "package.json")))
    s.summary = "lorem ipsum"
    s.license = "private"

But still facing this error:

BUILD FAILED

The following build commands failed: CompileC /Users/master/Library/Developer/Xcode/DerivedData/printapp3-bdgcuaoitzijpkgdxzcqqilqaxei/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/RNBluetoothEscposPrinter.build/Objects-normal/arm64/ZXResultParser.o /Users/master/Desktop/biolime/cfprint/node_modules/react-native-bluetooth-escpos-printer/ios/ZXingObjC-3.2.2/ZXingObjC/client/result/ZXResultParser.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNBluetoothEscposPrinter' from project 'Pods') (1 failure)