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 on iOS with RNFS.read function #1246

Open
keithdmoore opened this issue Feb 21, 2025 · 1 comment · May be fixed by #1247
Open

Error on iOS with RNFS.read function #1246

keithdmoore opened this issue Feb 21, 2025 · 1 comment · May be fixed by #1247

Comments

@keithdmoore
Copy link

keithdmoore commented Feb 21, 2025

When attempting to read a file with RNFS.read like this:

const chunk = await RNFS.read(uri, CHUNK_SIZE, position, 'base64')

I get this error:
[Error: RNFSManager.read(): Error while converting JavaScript argument 1 to Objective C type NSInteger. Objective C type NSInteger is unsupported.]

"react-native-fs": "^2.20.0",
"react-native": "0.76.5",

@keithdmoore
Copy link
Author

This issue is with the length and position parameters in RNFSManager.m read method:

Should be:
RCT_EXPORT_METHOD(read:(NSString *)filepath
length: (NSInteger)length
position: (NSInteger)position
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)

instead of:
RCT_EXPORT_METHOD(read:(NSString *)filepath
length: (NSInteger *)length
position: (NSInteger *)position
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)

Here is a patch file in case others run into this issue:

react-native-fs+2.20.0.patch

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

Successfully merging a pull request may close this issue.

1 participant