apache / apache/cordova-plugin-file

Flag iOS 9.0 deprecation warnings

Open
#631 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
744
Forks
754
Avg merge
3d 4h
Merged PRs (30d)
1

Description

# Bug Report

## Problem

### What is expected to happen?

Not to see deprecation warnings for iOS 9.0

### What does actually happen?

The following deprecation warnings appear in my log when building my Cordova app on [monaca.io](https://monaca.io/).

`stringByAddingPercentEscapesUsingEncoding` is deprecated: first deprecated in iOS 9.0

- Use `stringByAddingPercentEncodingWithAllowedCharacters`: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.
- [`CDVLocalFilesystem.m:128:43`](https://github.com/apache/cordova-plugin-file/blob/master/src/ios/CDVLocalFilesystem.m#L128)
- [`CDVFile.m:590:25`](https://github.com/apache/cordova-plugin-file/blob/master/src/ios/CDVFile.m#L590)

`stringByReplacingPercentEscapesUsingEncoding` is deprecated: first deprecated in iOS 9.0

- Use `stringByRemovingPercentEncoding` instead, which always uses the recommended UTF-8 encoding.
- [`CDVFile.m:589:35`](https://github.com/apache/cordova-plugin-file/blob/master/src/ios/CDVFile.m#L589)

## Information

Apple docs: https://developer.apple.com/documentation/foundation/nsstring/1407783-stringbyreplacingpercentescapesu

### Command or Code

Forgive me if this is the wrong command - I'm extracting it from the log Monaca automatically generates.

```
CompileC /Users/builder/Library/Developer/Xcode/DerivedData/Assess-dlavgjwbqzsbhgafcbkmwzzohbxe/Build/Intermediates.noindex/ArchiveIntermediates/Assess/IntermediateBuildFilesPath/Assess.build/Release-iphoneos/Assess.build/Objects-normal/arm64/CDVLocalFilesystem.o /tmp/download/platforms/ios/Assess/Plugins/cordova-plugin-file/CDVLocalFilesystem.m
```

### Environment, Platform, Device

iOS (also present in OSX)

### Version information

Cordova: 12
Cordova iOS: 7.1.0
Cordova Plugin File: 8.1.0
Xcode: 15.0.1

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Inspect src/ios/CDVLocalFilesystem.m at line 128 and src/ios/CDVFile.m at lines 589-590, then compare the reported deprecated NSString calls with Apple's documented replacements. Done means the iOS and macOS builds no longer emit the iOS 9.0 deprecation warnings for these calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.