在我的项目ios和android中使用simple_permissions时出现问题

时间:2019-02-09 22:26:11

标签: ios flutter

当我将软件包添加到pubspec.yaml时出现此错误

Launching lib/main.dart on iPhone 7 Plus in debug mode...
Xcode build done.                                            2.6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    === BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/zimbronapps/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/ios/Classes/SimplePermissionsPlugin.m:2:9: fatal error: 'simple_permissions/simple_permissions-Swift.h' file not found

我需要为Android版本使用simple_permission

pubspec.yaml,在下一个代码框中,我需要写更多文本,因为我无法添加它,请问有人可以帮助我吗?

name: myapp
description: A new Flutter project.

version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  launch_review: ^1.0.1
  url_launcher: ^5.0.1
  share: ^0.6.0+1
  shared_preferences: ^0.5.0
  flutter_sound: ^1.3.1
  path_provider: ^0.4.1
  permission: ^0.1.1 
  audioplayers: ^0.8.1
  firebase_admob: ^0.8.0+1

dev_dependencies:
  flutter_test:
    sdk: flutter


flutter:

  uses-material-design: true

  assets:
   - ./assets/drawable/
   - ./assets/raw/

这是我的pubspec.yaml

1 个答案:

答案 0 :(得分:0)

尝试

编辑您的Podfile

在“ target'Runner'do”行号〜35之后添加或取消注释

use_frameworks!

然后在行号〜67之后添加此行

config.build_settings['SWIFT_VERSION'] = '4.0'

示例:

target 'Runner' do
  ** use_frameworks!  **

... ......

post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ENABLE_BITCODE'] = 'NO'
          ** config.build_settings['SWIFT_VERSION'] = '4.0' **
        end
      end
    end

删除您的Podfile.lock并尝试。祝你好运