[ios] Convert `int` in Dart to `long long` in Objective-C. (#39331)
For native targets, an `int` in Dart maps to a signed 64-bit integer representation.
diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
index 8df862e..2612c13 100644
--- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
+++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
@@ -193,14 +193,14 @@
void FlutterPlatformViewsController::OnCreate(FlutterMethodCall* call, FlutterResult& result) {
NSDictionary<NSString*, id>* args = [call arguments];
- long viewId = [args[@"id"] longValue];
+ int64_t viewId = [args[@"id"] longLongValue];
NSString* viewTypeString = args[@"viewType"];
std::string viewType(viewTypeString.UTF8String);
if (views_.count(viewId) != 0) {
result([FlutterError errorWithCode:@"recreating_view"
message:@"trying to create an already created view"
- details:[NSString stringWithFormat:@"view id: '%ld'", viewId]]);
+ details:[NSString stringWithFormat:@"view id: '%lld'", viewId]]);
}
NSObject<FlutterPlatformViewFactory>* factory = factories_[viewType].get();
@@ -234,7 +234,8 @@
arguments:params];
UIView* platform_view = [embedded_view view];
// Set a unique view identifier, so the platform view can be identified in unit tests.
- platform_view.accessibilityIdentifier = [NSString stringWithFormat:@"platform_view[%ld]", viewId];
+ platform_view.accessibilityIdentifier =
+ [NSString stringWithFormat:@"platform_view[%lld]", viewId];
views_[viewId] = fml::scoped_nsobject<NSObject<FlutterPlatformView>>([embedded_view retain]);
FlutterTouchInterceptingView* touch_interceptor = [[[FlutterTouchInterceptingView alloc]
diff --git a/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.mm b/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.mm
index ac01ef5..ba2399a 100644
--- a/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.mm
+++ b/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewController.mm
@@ -90,7 +90,7 @@
if ([[call method] isEqualToString:@"create"]) {
NSMutableDictionary<NSString*, id>* args = [call arguments];
if ([args objectForKey:@"id"]) {
- int64_t viewId = [args[@"id"] longValue];
+ int64_t viewId = [args[@"id"] longLongValue];
NSString* viewType = [NSString stringWithUTF8String:([args[@"viewType"] UTF8String])];
[self onCreateWithViewID:viewId viewType:viewType result:result];
} else {
@@ -100,7 +100,7 @@
}
} else if ([[call method] isEqualToString:@"dispose"]) {
NSNumber* arg = [call arguments];
- int64_t viewId = [arg longValue];
+ int64_t viewId = [arg longLongValue];
[self onDisposeWithViewID:viewId result:result];
} else {
result(FlutterMethodNotImplemented);