pichillilorenzo / flutter_appavailability

A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.
https://pub.dartlang.org/packages/flutter_appavailability
MIT License
92 stars 89 forks source link

IOS Build Failed #3

Open ghost opened 5 years ago

ghost commented 5 years ago

Trying this package at IOS and getting this error using the example code:

BUILD FAILED Xcode's output: ↳ === BUILD TARGET flutter_appavailability OF PROJECT Pods WITH CONFIGURATION Debug === /Users/rodrigoavelino/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_appavailability-0.0.21/ios/Classes/AppAvailability.m:2:9: fatal error: 'flutter_appavailability/flutter_appavailability-Swift.h' file not found

import <flutter_appavailability/flutter_appavailability-Swift.h>

^~~~~~~~~~~~~ 1 error generated.

my flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G4015, locale pt-BR) [✓] Android toolchain - develop for Android devices (Android SDK 28.0.3) [✓] iOS toolchain - develop for iOS devices (Xcode 10.1) [✓] Android Studio (version 3.2) [✓] IntelliJ IDEA Community Edition (version 2018.3) [✓] VS Code (version 1.30.0) [✓] Connected device (1 available)

my Podfile

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 parse_KV_file(file, separator='=') file_abs_path = File.expand_path(file) if !File.exists? file_abs_path return []; end pods_ary = [] skip_line_start_symbols = ["#", "/"] File.foreach(file_abs_path) { |line| next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } plugin = line.split(pattern=separator) if plugin.length == 2 podname = plugin[0].strip() path = plugin[1].strip() podpath = File.expand_path("#{path}", file_abs_path) pods_ary.push({:name => podname, :path => podpath}); else puts "Invalid plugin specification: #{line}" end } return pods_ary end

target 'Runner' do

Prepare symlinks folder. We use symlinks to avoid having Podfile.lock

referring to absolute paths on developers' machines.

system('rm -rf .symlinks') system('mkdir -p .symlinks/plugins')

Flutter Pods

generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') if generated_xcode_build_settings.empty? puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." end generated_xcode_build_settings.map { |p| if p[:name] == 'FLUTTER_FRAMEWORK_DIR' symlink = File.join('.symlinks', 'flutter') File.symlink(File.dirname(p[:path]), symlink) pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) end }

Plugin Pods

plugin_pods = parse_KV_file('../.flutter-plugins') plugin_pods.map { |p| symlink = File.join('.symlinks', 'plugins', p[:name]) File.symlink(p[:path], symlink) pod p[:name], :path => File.join(symlink, 'ios') } end

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

my pubspec.yaml

name: plugin_flutter_availability description: A new Flutter project.

The following defines the version and build number for your application.

A version number is three numbers separated by dots, like 1.2.43

followed by an optional build number separated by a +.

Both the version and the builder number may be overridden in flutter

build by specifying --build-name and --build-number, respectively.

Read more about versioning at semver.org.

version: 1.0.0+1

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

dependencies: flutter: sdk: flutter flutter_appavailability: ^0.0.21

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^0.1.2

dev_dependencies: flutter_test: sdk: flutter

For information on the generic Dart part of this file, see the

following page: https://www.dartlang.org/tools/pub/pubspec

The following section is specific to Flutter.

flutter:

The following line ensures that the Material Icons font is

included with your application, so that you can use the icons in

the material Icons class.

uses-material-design: true

To add assets to your application, add an assets section, like this:

assets:

- images/a_dot_burr.jpeg

 #- images/a_dot_ham.jpeg

An image asset can refer to one or more resolution-specific "variants", see

https://flutter.io/assets-and-images/#resolution-aware.

For details regarding adding assets from package dependencies, see

https://flutter.io/assets-and-images/#from-packages

To add custom fonts to your application, add a fonts section here,

in this "flutter" section. Each entry in this list should have a

"family" key with the font family name, and a "fonts" key with a

list giving the asset and other descriptors for the font. For

example:

fonts:

- family: Schyler

  #fonts:
     #- asset: fonts/Schyler-Regular.ttf
     #- asset: fonts/Schyler-Italic.ttf
     #style: italic
     #- family: Trajan Pro
     #fonts:
      #- asset: fonts/TrajanPro.ttf
      #- asset: fonts/TrajanPro_Bold.ttf
       #weight: 700

For details regarding fonts from package dependencies,

see https://flutter.io/custom-fonts/#from-packages

ohkr2000 commented 5 years ago

I have the same problem

pichillilorenzo commented 5 years ago

Try this solution: https://github.com/pichillilorenzo/flutter_inappbrowser/issues/15#issuecomment-454083666

Jokernight commented 5 years ago

Hello,

The problem with the use_frameworks! solution is that other plugins doesn't support it and crash the build if it's present (it's the case of OneSignal).

Do you have any other solution to avoid this issue ?

Thanks by advance.