You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/07/31 20:54:02 UTC
(cordova-plugin-file) branch pr-ios-remove-use-of-CDVPluginResult.associatedObject created (now cbfae3d)
This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a change to branch pr-ios-remove-use-of-CDVPluginResult.associatedObject
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-file.git
at cbfae3d fix(ios): remove deprecated `CDVPluginResult.associatedObject` usage in `CDVFile`
This branch includes the following new commits:
new cbfae3d fix(ios): remove deprecated `CDVPluginResult.associatedObject` usage in `CDVFile`
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
(cordova-plugin-file) 01/01: fix(ios): remove deprecated `CDVPluginResult.associatedObject` usage in `CDVFile`
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch pr-ios-remove-use-of-CDVPluginResult.associatedObject
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-file.git
commit cbfae3db73d8804944ae3ea27232ff9428027965
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Fri Jul 31 22:53:53 2026 +0200
fix(ios): remove deprecated `CDVPluginResult.associatedObject` usage in `CDVFile`
- replace `initWithBytesNoCopy` string creation with `initWithData:encoding:` in iOS read paths
- remove `result.associatedObject = data` assignments in `readAsText` and `readAsBinaryString`
- keep behavior the same while eliminating Cordova iOS 8 deprecation warnings
Generated-By: GPT-5.3-Codex
---
src/ios/CDVFile.m | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m
index 59e7d64..5e40059 100644
--- a/src/ios/CDVFile.m
+++ b/src/ios/CDVFile.m
@@ -863,11 +863,10 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile";
[fs readFileAtURL:localURI start:start end:end callback:^(NSData* data, NSString* mimeType, CDVFileError errorCode) {
CDVPluginResult* result = nil;
if (data != nil) {
- NSString* str = [[NSString alloc] initWithBytesNoCopy:(void*)[data bytes] length:[data length] encoding:NSUTF8StringEncoding freeWhenDone:NO];
+ NSString* str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
// Check that UTF8 conversion did not fail.
if (str != nil) {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:str];
- result.associatedObject = data;
} else {
errorCode = ENCODING_ERR;
}
@@ -962,9 +961,8 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile";
[fs readFileAtURL:localURI start:start end:end callback:^(NSData* data, NSString* mimeType, CDVFileError errorCode) {
CDVPluginResult* result = nil;
if (data != nil) {
- NSString* payload = [[NSString alloc] initWithBytesNoCopy:(void*)[data bytes] length:[data length] encoding:NSASCIIStringEncoding freeWhenDone:NO];
+ NSString* payload = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:payload];
- result.associatedObject = data;
} else {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsInt:errorCode];
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org