Skip to content

[Bug]: CalendarFullAccess status is always denied in iOS 17+ #1306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 5 tasks
viplavrawal opened this issue Apr 12, 2024 · 8 comments
Open
3 of 5 tasks

[Bug]: CalendarFullAccess status is always denied in iOS 17+ #1306

viplavrawal opened this issue Apr 12, 2024 · 8 comments
Assignees
Labels
P2 Important issues not at the top of the work list. platform: ios Issue is related to the iOS platform

Comments

@viplavrawal
Copy link

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Steps to reproduce

  1. Use await Permission.calendarFullAccess.request(); to get calendar permission.
  2. Check await Permission.calendarFullAccess.status;

Expected results

await Permission.calendarFullAccess.status; should return granted when permission is granted by user.

Actual results

await Permission.calendarFullAccess.status; returns denied.

The result is the same even if the user permanently denies the permission.

Code sample

Code sample
await Permission.calendarFullAccess.request();

// On next app run or on another page
final status = await Permission.calendarFullAccess.status;
if (status == PermissionStatus.permanentlyDenied) {
    await openAppSettings();
} else {
    await Permission.calendarFullAccess.request();
}

Screenshots or video

No response

Version

11.3.1

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.4 23E214 darwin-arm64, locale en-IN)
    • Flutter version 3.19.5 on channel stable at /Users/viplavrawal/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (2 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/viplavrawal/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0
@mvanbeusekom mvanbeusekom self-assigned this Apr 12, 2024
@mvanbeusekom mvanbeusekom added platform: ios Issue is related to the iOS platform status: needs more info We need more information before we can continue work on this issue. P2 Important issues not at the top of the work list. labels Apr 12, 2024
@mvanbeusekom
Copy link
Member

Hi @viplavrawal,

Are the required entries added to the ios/Podfile?

As per documentation (expand the iOS section) the PERMISSION_EVENTS_FULL_ACCESS has to be set to 1 to enable support for the calendarFullAccess permission.

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Apr 12, 2024
@mvanbeusekom mvanbeusekom added the status: needs more info We need more information before we can continue work on this issue. label Apr 12, 2024
@viplavrawal
Copy link
Author

Hi @mvanbeusekom
Yes. I added PERMISSION_EVENTS_FULL_ACCESS and later PERMISSION_EVENTS as well just to be sure.
The dialog for permission opens correctly and the permission is also granted. It's just that the status remains denied.

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Apr 12, 2024
@peng093
Copy link

peng093 commented Apr 16, 2024

I have the same problem,added PERMISSION_EVENTS_FULL_ACCESS and PERMISSION_EVENTS ,Authorization popup does not pop

@seungku
Copy link

seungku commented May 9, 2024

I also have the same issue.

@mvanbeusekom
Copy link
Member

Instead of saying "I have the same", which really doesn't help resolving the issue, try to provide more information about the bug.

An example app reproducing the behavior for example would be of great help.

@pedrofneves
Copy link

I'm facing a similar problem but I'm using flutter as a static library because we already have a native iOS swift app.

I run the command:
flutter build ios-framework --no-profile --no-debug --cocoapods --static

then link de frameworks.

The runs normally but the request popup does not appear.

When I use the only the flutter code running a example code (just use the command "flutter run"), the popup appears.

@FySanta
Copy link

FySanta commented Oct 8, 2024

pdfile:
51728383998_ pic
info.plist:
61728384032_ pic
running order:
permission == Permission.calendarFullAccess
71728384135_ pic
await permission.request().isGranted is true, but await permission.status.isGranted is false;
await Permission.calendarFullAccess.status; should return granted when permission is granted by user.

After restarting the app await Permission.calendarFullAccess.status.isGranted will become true

@mrcsilverfox
Copy link

Hi @mvanbeusekom

Here some info to reproduce the bug.

Please select affected platform(s)

  • iOS

Package version: ^11.3.1

Code Sample

Code sample
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  Future<void> _onTap() async {
    const permission = Permission.calendarFullAccess;
    await permission.request();

    final permissionToString = '$permission=${await permission.status}';

    // It prints: Permission.calendarFullAccess=PermissionStatus.denied
    print('The permission status is now: $permissionToString');

    // Permission status is always denied, but if the user changes the
    // permission from the app settings, the status is changed to granted.
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Calendar permission'),
        ),
        body: Center(child: ElevatedButton(
          onPressed: _onTap,
          child: const Text('Request Calendar Permission'),
        ),),
      ),
    );
  }
}

iOS App Configuration

Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '14.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        'PERMISSION_EVENTS=1',
        
        'PERMISSION_EVENTS_FULL_ACCESS=1',
      ]

    end
  end
end

Info plist
<!-- add these lines -->
<key>NSCalendarsUsageDescription</key>
<string>Access most functions for calendar viewing and editing.</string>
<key>NSCalendarsFullAccessUsageDescription</key>
<string>Access most functions for calendar viewing and editing.</string>

Flutter Doctor output

Output
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.7 23H124 darwin-arm64, locale it-IT)
    • Flutter version 3.24.3 on channel stable at /Users/marcotrivisonno/fvm/versions/3.24.3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (8 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/marcotrivisonno/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.95.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.100.0

[✓] Connected device (5 available)
    • iPhone 16 Pro (mobile)          • 0285BFF7-D8AC-4D0F-A37D-C5B851BB8A3E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-0
      (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.7 23H124 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.7 23H124 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 130.0.6723.117

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Expected results

flutter: The permission status is now: Permission.calendarFullAccess=PermissionStatus.granted

Actual results

flutter: The permission status is now: Permission.calendarFullAccess=PermissionStatus.denied.
Permission status is always denied, but if the user changes the permission from the app settings, the status is changed to granted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: ios Issue is related to the iOS platform
Projects
None yet
Development

No branches or pull requests

7 participants