Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple rejection. NSAppleMusicUsageDescription #302

Closed
1 of 2 tasks
gusabdala opened this issue May 26, 2020 · 12 comments
Closed
1 of 2 tasks

Apple rejection. NSAppleMusicUsageDescription #302

gusabdala opened this issue May 26, 2020 · 12 comments

Comments

@gusabdala
Copy link

gusabdala commented May 26, 2020

馃悰 Bug Report

Apple rejects due to not defining NSAppleMusicUsageDescription even when not needing this permission.

Expected behavior

Should be able to disable this via preprocessor definition.

Reproduction steps

Configuration

Version: 5.0.0+hotfix.6

Platform:

  • 馃摫 iOS
  • 馃 Android
@gusabdala
Copy link
Author

@mvanbeusekom Is this something you could resolve?

@smasinde
Copy link

smasinde commented Jun 2, 2020

What I did, and what others have suggested is to add it to the info file and state that your "app does not use this permission, if requested please reject." It shouldn't ever call though.

If you want to disable it completely, this seems to work I haven't tried it.
#26 (comment)

@shahnawazahmed88
Copy link

shahnawazahmed88 commented Jun 8, 2020

@gusabdala you can mention dummy permission like this in info.plist

<key>NSAppleMusicUsageDescription</key>
<string>This permission is not needed by the app, but it is required by an underlying API. If you see this dialog, contact us.</string>

@digitallysavvy
Copy link

digitallysavvy commented Nov 27, 2020

I've seen this before and the reason (from my understanding) is because if an underlying SDK or framework requires a certain permission for a specific feature (regardless of whether you implement that feature), you need to include that permission in your plist. The reasoning being, if somehow that code is triggered and the permission isn't accounted for in the plist, it will cause a crash and from my experience Apple review won't allow for such a possibility.

I would echo the comments from @smasinde and @shahnawazahmed88

@mohdtaha60
Copy link

Any update on this?

@msayed-net
Copy link

Any updates!

@mvanbeusekom
Copy link
Member

Can someone confirm the contents of the ios/Podfile?

Also which version of the plugin are you using?

@msayed-net
Copy link

Here is mine,

# Uncomment this line to define a global platform for your project
# platform :ios, '9.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__))
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)',

        ## dart: PermissionGroup.calendar
        'PERMISSION_EVENTS=0',

        ## dart: PermissionGroup.reminders
        'PERMISSION_REMINDERS=0',

        ## dart: PermissionGroup.contacts
        'PERMISSION_CONTACTS=0',

        ## dart: PermissionGroup.camera
        'PERMISSION_CAMERA=0',

        ## dart: PermissionGroup.microphone
        'PERMISSION_MICROPHONE=0',

        ## dart: PermissionGroup.speech
        'PERMISSION_SPEECH_RECOGNIZER=0',

        ## dart: PermissionGroup.photos
        # 'PERMISSION_PHOTOS=0',

        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
        'PERMISSION_LOCATION=0',

        ## dart: PermissionGroup.notification
        'PERMISSION_NOTIFICATIONS=0',

        ## dart: PermissionGroup.mediaLibrary
        # 'PERMISSION_MEDIA_LIBRARY=0',

        ## dart: PermissionGroup.sensors
        'PERMISSION_SENSORS=0',

        ## dart: PermissionGroup.bluetooth 
        'PERMISSION_BLUETOOTH=0',
      ]
    end
  end
end

@msayed-net
Copy link

please note, I had to add those lines to my info.plist

<key>NSAppleMusicUsageDescription</key>
<string>This permission is not needed by the app, but it is required by an underlying API. If you see this dialog, contact us.</string>

@mvanbeusekom
Copy link
Member

I am assuming you are using a version of the permission_handler before 8.0.0, where permission are all enabled by default (this behavior is flipped since version 8.0.0 and higher). In this case the reason is because the PERMISSION_MEDIA_LIBRARY is enabled (commented out in the ios/Podfile).

The PERMISSION_MEDIA_LIBRARY macro enables/ includes the iOS MPMediaLibrary framework which in turn requires the NSAppleMusicUsageDescription in the Info.plist. If you don't need access to the devices media library you can remove the comment character in the ios/Podfile for the PERMISSION_MEDIA_LIBRARY macro.

@khalilyamoun
Copy link

Hello, any updates regarding this ?

@mvanbeusekom
Copy link
Member

Closing this issue as the problem is caused by misconfiguration (see comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants