Remove some trivial deprecated symbol usages in iOS Embedder (flutter/engine#42711)

stringWithCString was deprecated in iOS 2.0
UIAccessibilityVoiceOverStatusChanged was deprecated in iOS 11.0

fixes: https://github.com/flutter/flutter/issues/128732
https://github.com/flutter/flutter/issues/128736

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Chris Yang
2023-06-13 15:26:59 -07:00
committed by GitHub
parent 4f88b3f075
commit cc1ec72179
3 changed files with 4 additions and 5 deletions

View File

@@ -678,7 +678,7 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
// TODO(gaaclarke): Find way to eliminate this data copy.
NSData* data = [NSData dataWithBytes:screenshot.data->writable_data()
length:screenshot.data->size()];
NSString* format = [NSString stringWithCString:screenshot.format.c_str()];
NSString* format = [NSString stringWithUTF8String:screenshot.format.c_str()];
NSNumber* width = @(screenshot.frame_size.fWidth);
NSNumber* height = @(screenshot.frame_size.fHeight);
return result(@[ width, height, format, data ]);
@@ -821,8 +821,7 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS
if (initialRoute != nil) {
self.initialRoute = initialRoute;
} else if (settings.route.empty() == false) {
self.initialRoute = [NSString stringWithCString:settings.route.c_str()
encoding:NSUTF8StringEncoding];
self.initialRoute = [NSString stringWithUTF8String:settings.route.c_str()];
}
FlutterView.forceSoftwareRendering = settings.enable_software_rendering;

View File

@@ -342,7 +342,7 @@ typedef struct MouseState {
[center addObserver:self
selector:@selector(onAccessibilityStatusChanged:)
name:UIAccessibilityVoiceOverStatusChanged
name:UIAccessibilityVoiceOverStatusDidChangeNotification
object:nil];
[center addObserver:self

View File

@@ -114,7 +114,7 @@ NS_INLINE NSString* _platformName() {
char* answer = malloc(size);
sysctlbyname("hw.model", answer, &size, NULL, 0);
NSString* results = [NSString stringWithCString:answer encoding:NSUTF8StringEncoding];
NSString* results = [NSString stringWithUTF8String:answer];
free(answer);
return results;
}