Fixed build of example code to use new binary messenger API. (#35825)
Fixed build of example code to use new binary messenger API.
diff --git a/dev/bots/test.dart b/dev/bots/test.dart
index fc739f1..7818b77 100644
--- a/dev/bots/test.dart
+++ b/dev/bots/test.dart
@@ -272,12 +272,10 @@
continue;
}
final String examplePath = fileEntity.path;
- final String basename = path.basename(examplePath);
- final bool expectIpaBuildFailure = basename == 'platform_channel_swift'; // Remove when https://github.com/flutter/flutter/issues/35773 is fixed.
await _flutterBuildAot(examplePath);
await _flutterBuildApk(examplePath);
- await _flutterBuildIpa(examplePath, expectIpaBuildFailure: expectIpaBuildFailure);
+ await _flutterBuildIpa(examplePath);
}
await _flutterBuildDart2js(path.join('dev', 'integration_tests', 'web'));
@@ -322,7 +320,7 @@
print('Done.');
}
-Future<void> _flutterBuildIpa(String relativePathToApplication, {bool expectIpaBuildFailure = false}) async {
+Future<void> _flutterBuildIpa(String relativePathToApplication) async {
if (!Platform.isMacOS) {
return;
}
@@ -341,7 +339,7 @@
await runCommand(flutter,
<String>['build', 'ios', '--no-codesign', '--debug', '-v'],
workingDirectory: path.join(flutterRoot, relativePathToApplication),
- expectNonZeroExit: expectIpaBuildFailure,
+ expectNonZeroExit: false,
timeout: _kShortTimeout,
);
print('Done.');
diff --git a/examples/platform_channel_swift/ios/Runner/AppDelegate.swift b/examples/platform_channel_swift/ios/Runner/AppDelegate.swift
index 04ca367..937c819 100644
--- a/examples/platform_channel_swift/ios/Runner/AppDelegate.swift
+++ b/examples/platform_channel_swift/ios/Runner/AppDelegate.swift
@@ -31,7 +31,7 @@
fatalError("rootViewController is not type FlutterViewController")
}
let batteryChannel = FlutterMethodChannel(name: ChannelName.battery,
- binaryMessenger: controller)
+ binaryMessenger: controller.binaryMessenger)
batteryChannel.setMethodCallHandler({
[weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in
guard call.method == "getBatteryLevel" else {
@@ -42,7 +42,7 @@
})
let chargingChannel = FlutterEventChannel(name: ChannelName.charging,
- binaryMessenger: controller)
+ binaryMessenger: controller.binaryMessenger)
chargingChannel.setStreamHandler(self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}