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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building for iOS after following SDK setup tutorial #57

Closed
lifenautjoe opened this issue Jan 31, 2019 · 31 comments
Closed

Error when building for iOS after following SDK setup tutorial #57

lifenautjoe opened this issue Jan 31, 2019 · 31 comments

Comments

@lifenautjoe
Copy link

Head's up: It's not working for android either. See #56
__

Description:
After following every step, to the letter of the Official SDK Setup, when running

flutter build ios --release

The job fails with

Building social.openbook.app for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: GAR7B57RXU
Running pod install...                                       1.6s
Starting Xcode build...
Xcode build done.                                            1.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Pods-Runner OF PROJECT Pods WITH CONFIGURATION Release-production ===
    ld:
    '/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/TOCropViewController/libTOCropViewController.a(TOActivityCroppedIm
    ageProvider.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or
    disable bitcode for this target. file
    '/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/TOCropViewController/libTOCropViewController.a' for architecture
    armv7
    clang: error: unable to execute command: Segmentation fault: 11
    clang: error: linker command failed due to signal (use -v to see invocation)
    ld:
    '/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/TOCropViewController/libTOCropViewController.a(TOActivityCroppedIm
    ageProvider.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or
    disable bitcode for this target. file
    '/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/TOCropViewController/libTOCropViewController.a' for architecture
    arm64
    clang: error: unable to execute command: Segmentation fault: 11
    clang: error: linker command failed due to signal (use -v to see invocation)
    === BUILD TARGET Pods-Runner OF PROJECT Pods WITH CONFIGURATION Release-production ===
    error: the following command failed with exit code 254 but produced no further output
    Ld
    /Users/lifenautjoe/Library/Developer/Xcode/DerivedData/Runner-fyejgxaqxiysevckyfsvnqjhzfai/Build/Intermediates.noindex/Runner.build/Release-production-iphoneos/O
    neSignalNotificationServiceExtension.build/Objects-normal/arm64/OneSignalNotificationServiceExtension normal arm64

I really have no clue what this might be.

Environment

@Nightsd01
Copy link
Contributor

@lifenautjoe please post your Podfile

@lifenautjoe
Copy link
Author

Sorry about that.

Here it is

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

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

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

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 2.9.3', '< 3.0'
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

@lifenautjoe
Copy link
Author

This is what I get when I try to build on XCode

image

@lifenautjoe
Copy link
Author

Hour 7 of breaking my head..

Reading through the iOS SDK Setup, I've noticed it's mentioned that after adding the service extension, the project must be always built from the xcode workspace, rather than the xcode project.

So I closed XCode, reopened the workspace file, hit build and it built successfully.

However...

From flutter commands such as flutter run or flutter build, it fails with errors related to not being able to locate directories.

Building social.openbook.app for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: GAR7B57RXU
Running pod install...                                       1.6s
Starting Xcode build...
Xcode build done.                                            2.2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    ld: warning: directory not found for option '-L/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/image_cropper'
    ld: warning: directory not found for option '-L/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/video_player'
    ld: library not found for -limage_cropper
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ld: warning: directory not found for option '-L/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/image_cropper'
    ld: warning: directory not found for option '-L/Users/lifenautjoe/Documents/code/openbook/openbook-app/build/ios/Release-production-iphoneos/video_player'
    ld: library not found for -limage_cropper
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

My best bet is that flutter doesnt take into consideration the workspace mode and rather tries to build the project, therefore it fails (?)

Please, save me from having to use Firebase notifications 😢.

@lifenautjoe
Copy link
Author

Update: Archiving the app from XCode does not work, only running it.

Errors are the same. Libraries not found.

@Nightsd01
Copy link
Contributor

@lifenautjoe sorry you’ve spent so much time on this! Unfortunately Flutter uses Cocoapods in a rather......unique.....way, and this can lead to issues like this.

It appears you’re facing a similar issue to #42

Do you need badge count notifications, images, etc? If not, removing the extension service entirely should fix this for you.

If you do, unfortunately Flutter’s Cocoapods scripts don’t play nice with projects that have app extensions, there’s not much we can do. I would suggest creating an issue on the Flutter repo

@lifenautjoe
Copy link
Author

Hi @Nightsd01 ,

Sorry to hear that... Don't really know where to start to explain this to the Flutter team. I have no expertise with iOS nor Cocoapods.

For now.. I guess no other choice but to use Firebase Messaging...

Cheers.

@Nightsd01
Copy link
Contributor

@lifenautjoe if you intend to use rich push notifications with images you will likely run into the same issue with Firebase. The user in #42 found a workaround - I’d suggest starting there

@Nightsd01
Copy link
Contributor

@lifenautjoe I would also suggest trying to run our example project. Do you run into the same problem there?

@lifenautjoe
Copy link
Author

Alright, hoping on the person to shed some light into his solution.

Will try running the project tomorrow morning first hour.

Cheers for now and thanks for being around!

@Allan-Nava
Copy link

I got this error:

Xcode's output:
↳
    === BUILD TARGET firebase_core OF PROJECT Pods WITH CONFIGURATION Debug ===
    In file included from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.5/ios/Classes/OneSignalCategories.m:28:
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.5/ios/Classes/OneSignalCategories.h:28:9: fatal error: 'OneSignal/OneSignal.h' file not found
    #import <OneSignal/OneSignal.h>
            ^~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

@Nightsd01
Copy link
Contributor

@lifenautjoe any updates on this?

@Allan-Nava please post your Podfile....

@thedude61636
Copy link

@Nightsd01

hi i'm having the same issue
this is my pod file, please notice that i added use_framework! to the OneSignalNotificationServiceExtension target as cocoa complained that i don't have both targets (runner and the extension) set to use it

I'm having the same issue as @Allan-Nava

# 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,
}


target 'OneSignalNotificationServiceExtension' do
  use_frameworks!
  pod 'OneSignal', '>= 2.9.3', '< 3.0'
end


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
      use_frameworks!

  # 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

@Allan-Nava
Copy link

Allan-Nava commented Feb 10, 2019 via email

@Nightsd01
Copy link
Contributor

@thedude61636 this issue has been discussed (extensively). If you use use_frameworks! in your Podfile, our SDK simply will not work - there is currently no way around this unfortunately. Please see #21 for more detail.

@Nightsd01
Copy link
Contributor

@Allan-Nava Really...? Please post your Podfile.....

@thedude61636
Copy link

@Nightsd01 okay, noted.
does downloading the sdk directly from the repo work? because as far as i understand the issue is with cocoa
I'm new to ios so please bare with me

@Nightsd01
Copy link
Contributor

@thedude61636 the problem is that our Flutter SDK depends on our native iOS SDK, so it’s not a direct dependency. If you can figure out a way to do it I’d love to hear it.

@lifenautjoe
Copy link
Author

Hi everyone. I fixed it with help of @smjcdowall.

It's a work-around and I hope a temporal one.

The steps are here #42 (comment) .

Cheers.

@Allan-Nava
Copy link

I got this error:

Xcode's output:
↳
    In file included from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.5/ios/Classes/OneSignalPlugin.m:28:
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.5/ios/Classes/OneSignalPlugin.h:29:9: fatal error: 'OneSignal/OneSignal.h' file not found
    #import <OneSignal/OneSignal.h>
            ^~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:31: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewController:(SFSafariViewController *)controller
                                  ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:1: note: annotate 'safariViewController:didCompleteInitialLoad:' with an availability attribute to silence this warning
    - (void)safariViewController:(SFSafariViewController *)controller
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:40: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
                                           ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:1: note: annotate 'safariViewControllerDidFinish:' with an availability attribute to silence this warning
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
    ^
                                                                                API_AVAILABLE(ios(9.0))
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: warning: 'openURL:options:completionHandler:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        [application openURL:url
                     ^~~~~~~~~~~
    In module 'UIKit' imported from /Users/ies/Desktop/work/nlite/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:135:1: note: 'openURL:options:completionHandler:' has been explicitly marked partial here
    - (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: note: enclose 'openURL:options:completionHandler:' in an @available check to silence this warning
        [application openURL:url
                     ^~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
Could not build the precompiled application for the device.
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController

               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    5 warnings generated.
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:31: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewController:(SFSafariViewController *)controller
                                  ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:1: note: annotate 'safariViewController:didCompleteInitialLoad:' with an availability attribute to silence this warning
    - (void)safariViewController:(SFSafariViewController *)controller
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:40: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
                                           ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:1: note: annotate 'safariViewControllerDidFinish:' with an availability attribute to silence this warning
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
    ^
                                                                                API_AVAILABLE(ios(9.0))
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: warning: 'openURL:options:completionHandler:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        [application openURL:url
                     ^~~~~~~~~~~
    In module 'UIKit' imported from /Users/ies/Desktop/work/nlite/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:135:1: note: 'openURL:options:completionHandler:' has been explicitly marked partial here
    - (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: note: enclose 'openURL:options:completionHandler:' in an @available check to silence this warning
        [application openURL:url
                     ^~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    5 warnings generated.

I used the same pod @thedude61636

@Nightsd01
Copy link
Contributor

@Allan-Nava if you are using the same Podfile as @thedude61636 then the comment I posted for him would apply in your case as well. Our framework is not compatible with use_frameworks! at the moment...

@Allan-Nava
Copy link

Allan-Nava commented Feb 12, 2019 via email

@Allan-Nava
Copy link

@lifenautjoe when I use your PodFile I got this error:


[!] Unable to integrate the following embedded targets with their respective host targets (a host target is a "parent" target which embeds a "child" target like a framework or extension):

- Runner (true) and OneSignalNotificationServiceExtension (false) do not both set use_frameworks!.

@thedude61636
Copy link

@Allan-Nava you have to remove use_framework! from the podfile

@Allan-Nava
Copy link

@thedude61636 this is my Podfile:

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

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 2.9.5', '< 3.0'
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

@Allan-Nava
Copy link

I got this error:

Xcode's output:
↳
    In file included from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.5/ios/Classes/OneSignalPlugin.m:28:
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.5/ios/Classes/OneSignalPlugin.h:29:9: fatal error: 'OneSignal/OneSignal.h' file not found
    #import <OneSignal/OneSignal.h>
            ^~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:31: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewController:(SFSafariViewController *)controller
                                  ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:1: note: annotate 'safariViewController:didCompleteInitialLoad:' with an availability attribute to silence this warning
    - (void)safariViewController:(SFSafariViewController *)controller
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:40: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
                                           ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:1: note: annotate 'safariViewControllerDidFinish:' with an availability attribute to silence this warning
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
    ^
                                                                                API_AVAILABLE(ios(9.0))
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: warning: 'openURL:options:completionHandler:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        [application openURL:url
                     ^~~~~~~~~~~
    In module 'UIKit' imported from /Users/ies/Desktop/work/nlite/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:135:1: note: 'openURL:options:completionHandler:' has been explicitly marked partial here
    - (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: note: enclose 'openURL:options:completionHandler:' in an @available check to silence this warning
        [application openURL:url
                     ^~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
Could not build the precompiled application for the device.
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController

               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    5 warnings generated.
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:31: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewController:(SFSafariViewController *)controller
                                  ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:1: note: annotate 'safariViewController:didCompleteInitialLoad:' with an availability attribute to silence this warning
    - (void)safariViewController:(SFSafariViewController *)controller
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:40: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
                                           ^
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:1: note: annotate 'safariViewControllerDidFinish:' with an availability attribute to silence this warning
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
    ^
                                                                                API_AVAILABLE(ios(9.0))
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: warning: 'openURL:options:completionHandler:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        [application openURL:url
                     ^~~~~~~~~~~
    In module 'UIKit' imported from /Users/ies/Desktop/work/nlite/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:135:1: note: 'openURL:options:completionHandler:' has been explicitly marked partial here
    - (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: note: enclose 'openURL:options:completionHandler:' in an @available check to silence this warning
        [application openURL:url
                     ^~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been explicitly marked partial here
    @interface SFSafariViewController : UIViewController
               ^
    /Users/ies/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:38: note: enclose 'SFSafariViewController' in an @available check to silence this warning
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
                                         ^~~~~~~~~~~~~~~~~~~~~~
    5 warnings generated.

I used the same pod @thedude61636

With this Podfile I got this error again

@kostyaVyrodov
Copy link

I had the error bellow

=== BUILD AGGREGATE TARGET FirebaseAnalytics OF PROJECT Pods WITH CONFIGURATION Debug ===
    ld: warning: directory not found for option '-L/Users/kvyrodov/Projects/project/build/ios/Debug-iphonesimulator/FBSDKCoreKit'
    ld: warning: directory not found for option '-L/Users/kvyrodov/Projects/project/build/ios/Debug-iphonesimulator/FBSDKLoginKit'
    ld: warning: directory not found for option
    '-L/Users/kvyrodov/Projects/project/build/ios/Debug-iphonesimulator/flutter_facebook_login'
    ld: library not found for -lFBSDKCoreKit
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've linked all missed libraries and this fixed the error:

screenshot at feb 18 09-15-49

Thanks to this comment

@vmwsree
Copy link

vmwsree commented Feb 20, 2019

@lifenautjoe sorry you’ve spent so much time on this! Unfortunately Flutter uses Cocoapods in a rather......unique.....way, and this can lead to issues like this.

It appears you’re facing a similar issue to #42

Do you need badge count notifications, images, etc? If not, removing the extension service entirely should fix this for you.

If you do, unfortunately Flutter’s Cocoapods scripts don’t play nice with projects that have app extensions, there’s not much we can do. I would suggest creating an issue on the Flutter repo

How do you remove app extention

@rgomezp
Copy link
Contributor

rgomezp commented Apr 8, 2019

I'm closing this issue as it is a duplicate of #42 . You can follow any updates on the issue there.

@rgomezp rgomezp closed this as completed Apr 8, 2019
@rogeliotrejo13
Copy link

same error than @Allan-Nava
/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.1.0/ios/Classes/OneSignalCategories.h:28:9: fatal error:
'OneSignal/OneSignal.h' file not found
#import <OneSignal/OneSignal.h>
^~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
Any Update?
Thx A lot

@thenexus00
Copy link

same error than @Allan-Nava
/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.1.0/ios/Classes/OneSignalCategories.h:28:9: fatal error:
'OneSignal/OneSignal.h' file not found
#import <OneSignal/OneSignal.h>
^~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
Any Update?
Thx A lot

I was able to fix this issue by following the steps here:
Baseflow/flutter-geolocator#168

I had to update information in the pod file.
It is when you have links in your app to open in safari, it seems Apple made changes so when you run build through Xcode it is requiring the policy updates and minimum requirements are met. Part of it I think is you can not run an older swift version aimed at ios 9.0 on a version you may set as 11.0

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

9 participants