-
-
Notifications
You must be signed in to change notification settings - Fork 912
Description
Please check the following before submitting a new issue.
- I have searched the existing issues.
- I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- Android
- iOS
- Windows
Steps to reproduce
- Create Flutter project with permission_handler: ^12.0.1
- Enable Swift Package Manager: flutter config
--enable-swift-package-manager - Run flutter build ios --simulator
- Observe build failure on privacy bundle generation
Expected results
The privacy bundle should build successfully as a resource-only bundle containing just the PrivacyInfo.xcprivacy file.
Actual results
Current Behavior:
When using permission_handler_apple 9.4.7 in a Flutter project with Swift Package Manager enabled (hybrid SPM/CocoaPods setup), the iOS build fails with:
Error (Xcode): Build input file cannot be found:
'/path/to/build/ios/Debug-iphonesimulator/permission_handler_apple/permis
sion_handler_apple_privacy.bundle/permission_handler_apple_privacy'.
Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
The issue occurs because:
- Most plugins successfully migrate to SPM in the hybrid setup
- permission_handler_apple remains in CocoaPods (as expected, since it
doesn't have SPM support yet) - The CocoaPods resource bundle generation gets confused in the mixed environment
- Xcode expects an executable file in the privacy bundle, but it should be resource-only
The podspec correctly defines:
s.resource_bundles = {'permission_handler_apple_privacy' =>
['Resources/PrivacyInfo.xcprivacy']}
But the build system treats it as an executable bundle instead of a resource bundle.
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'dart:io';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Permission Handler SPM Bug',
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String _permissionStatus = 'Unknown';
Future<void> _requestMicrophonePermission() async {
if (Platform.isAndroid) {
final status = await Permission.microphone.request();
setState(() {
_permissionStatus = status.toString();
});
} else {
setState(() {
_permissionStatus = 'iOS permissions handled via Info.plist';
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Permission Handler SPM Bug'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Permission Status: $_permissionStatus'),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _requestMicrophonePermission,
child: const Text('Request Microphone Permission'),
),
],
),
),
);
}
}
Screenshots or video
Screenshots or video demonstration
[Upload media here]
Version
9.4.7
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.32.0, on macOS 15.5 24F74 darwin-arm64, locale
en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.102.1)
[✓] Connected device (3 available)
[✓] Network resources