diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index aaf05854eaa18..809c467a4e554 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -108,14 +108,16 @@ - (void)vibrateHapticFeedback:(NSString*)feedbackType { if (@available(iOS 10, *)) { if ([@"HapticFeedbackType.lightImpact" isEqualToString:feedbackType]) { - [[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight] impactOccurred]; + [[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight] autorelease] + impactOccurred]; } else if ([@"HapticFeedbackType.mediumImpact" isEqualToString:feedbackType]) { - [[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium] + [[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium] autorelease] impactOccurred]; } else if ([@"HapticFeedbackType.heavyImpact" isEqualToString:feedbackType]) { - [[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy] impactOccurred]; + [[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy] autorelease] + impactOccurred]; } else if ([@"HapticFeedbackType.selectionClick" isEqualToString:feedbackType]) { - [[[UISelectionFeedbackGenerator alloc] init] selectionChanged]; + [[[[UISelectionFeedbackGenerator alloc] init] autorelease] selectionChanged]; } } }