bamlab / react-native-image-resizer

🗻 Resize local images with React Native
MIT License
1.61k stars 347 forks source link

[iOS] No matching function for call to 'transformImage' #342

Closed ohayou12 closed 1 year ago

ohayou12 commented 2 years ago

run archive receive an error

error details:

No matching function for call to 'transformImage'

Candidate function not viable: no known conversion from 'NSNumber * _Nonnull const __strong' to 'BOOL' (aka 'signed char') for 8th argument

environment

"@bam.tech/react-native-image-resizer": "^3.0.3",

System:
    OS: macOS 12.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 3.28 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.17.0 - /var/folders/j5/mpyv7n8j7_x9cvfk07zk11hm0000gn/T/yarn--1666575782013-0.44907134180783537/node
    Yarn: 1.22.19 - /var/folders/j5/mpyv7n8j7_x9cvfk07zk11hm0000gn/T/yarn--1666575782013-0.44907134180783537/yarn
    npm: 6.14.13 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /Users/ohayou/.rvm/gems/ruby-3.1.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.1 => 0.64.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

variable keepMeta need a Bool in 53 line, but receive a NSNumber

https://github.com/bamlab/react-native-image-resizer/blob/2ab4fb4bda208b960740a5d9011ab1bc4d3de521/ios/ImageResizer.mm#L330-L338

https://github.com/bamlab/react-native-image-resizer/blob/2ab4fb4bda208b960740a5d9011ab1bc4d3de521/ios/ImageResizer.mm#L24-L60

taboulot commented 2 years ago

Hi @ohayou12 ,

Can you provide me an example.

This is what I tried on my side in the example project with last version :

let result = await ImageResizer.createResizedImage(
        image.uri,
        sizeTarget,
        sizeTarget,
        'JPEG',
        100,
        undefined,
        undefined,
        true // keepMeta true, same result with false
      );

And I had no error ...

taboulot commented 2 years ago

@ohayou12 Ok, I think the problem is that I did not keep the default value of keepMeta during the migration.

I fixed it in #343. It is deployed now on 3.0.4. Can you use it and keep me up-to-date?

davidarnaub7 commented 2 years ago

Hi @taboulot , I 've updated and getting the same error. Additionally, I copied the example you gave but the error remains.

any idea?

taboulot commented 2 years ago

Hmmmm.

Can you provide me a repo with a reproducible example ?

skorchi commented 2 years ago

i have resolve the probleme by changing in ImageResizer.m the type of keepMeta from (NSString *) to (BOOL)

in two line 19 and 24

for exemple in line 24 i changed `

By

- (void)createResizedImage:(NSString *)uri width:(double)width height:(double)height format:(NSString *)format quality:(double)quality mode:(NSString *)mode onlyScaleDown:(BOOL)onlyScaleDown rotation:(nonnull NSNumber *)rotation outputPath:(NSString *)outputPath keepMeta:(BOOL)keepMeta resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {

taboulot commented 2 years ago

@skorchi

Since the 3.x.x version the type is not (NSString *) but (NSNumber *) 🧐

See : https://github.com/bamlab/react-native-image-resizer/blob/7548326e7554b9cc5a9ae5c46512003506d30427/ios/ImageResizer.mm#L19-L25

taboulot commented 2 years ago

@davidarnaub7

And Are you able to reproduce it in the example project of the repo?

skorchi commented 2 years ago

@taboulot

i have the same problem, i fixed by changing the type of keepMeta by BOOL in line 19 and 24

ohayou12 commented 1 year ago

@taboulot in xcode, I run Product -> Archive, then I receive this error. It is normal if yarn ios is run.

keepMeta is a Bool at line 337, but NSNumber at line 53, which I think is probably due to the xcode version. Then I change keepMeta to true or false at line 53 and run Product -> Archive again and it works fine. https://github.com/bamlab/react-native-image-resizer/blob/7548326e7554b9cc5a9ae5c46512003506d30427/ios/ImageResizer.mm#L337 https://github.com/bamlab/react-native-image-resizer/blob/7548326e7554b9cc5a9ae5c46512003506d30427/ios/ImageResizer.mm#L53

chj-damon commented 1 year ago

same here.

chj-damon commented 1 year ago

@ohayou12 can you create a PR to fix this?

robingullo commented 1 year ago

@chj-damon Thank you for your contribution. Would you mind continuing the discussion in the PR ?

chj-damon commented 1 year ago

@robingullo updated.

taboulot commented 1 year ago

A fix has been published in 3.0.5.