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

XCode build fails #49

Closed
1 of 2 tasks
simongomez95 opened this issue Nov 27, 2018 · 7 comments · Fixed by #50
Closed
1 of 2 tasks

XCode build fails #49

simongomez95 opened this issue Nov 27, 2018 · 7 comments · Fixed by #50

Comments

@simongomez95
Copy link

simongomez95 commented Nov 27, 2018

Hi, I'm trying to use this library and it works great in Android, but when I try to build for iOS (after applying the fix in the description) it fails with the following output:

With config.build_settings['SWIFT_VERSION'] = '4.1' in Podfile

Error output from Xcode build:
↳
   2018-11-26 19:04:07.144 xcodebuild[20997:3693078]  DVTAssertions: Warning in
   /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-13756/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/Runtime/PB
   XTargetBuildContext.mm:757
   Details:  unexpected successful exit code from cancelled command <C0007:'CpHeader LocationPlugin.h':P8>
   Object:   <PBXTargetBuildContext: 0x7ff2a59d3f30>
   Method:   -createCommandInvocationRecordFromInvocation:
   Thread:   <NSThread: 0x7ff2a55bb360>{number = 5, name = (null)}
   Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
   ** BUILD FAILED **


Xcode's output:
↳
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:94:118: error: 'OpenExternalURLOptionsKey' is
   not a member type of 'UIApplication'
   fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
                                                                                                          ~~~~~~~~~~~~~ ^
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:55:77: error: type 'UIApplication' has no
   member 'openSettingsURLString'
                   let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
                                                                               ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/ios/Classes/FirebaseCorePlugin.m:13:17: warning: property 'dictionary' requires
   method 'dictionary' to be defined - use @dynamic or provide a method implementation in this category [-Wobjc-property-implementation]
   @implementation FIROptions (FLTFirebaseCorePlugin)
                   ^
   /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/ios/Classes/FirebaseCorePlugin.m:10:46: note: property declared here
   @property(readonly, nonatomic) NSDictionary *dictionary;
                                                ^
   1 warning generated.

With config.build_settings['SWIFT_VERSION'] = '3.2' in Podfile

Xcode's output:
↳
    === BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:14:80: error: type
    'AVMediaType' (aka 'NSString') has no member 'video'
                return AudioVideoPermissionStrategy.getPermissionStatus(mediaType: AVMediaType.video)
                                                                                   ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:16:80: error: type
    'AVMediaType' (aka 'NSString') has no member 'audio'
                return AudioVideoPermissionStrategy.getPermissionStatus(mediaType: AVMediaType.audio)
                                                                                   ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:23:86: error:
    'AVMediaType' (aka 'NSString') is not implicitly convertible to 'String!'; did you mean to use 'as' to explicitly convert?
            let status: AVAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: mediaType)
                                                                                         ^
                                                                                                   as String!
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:48:25: error: type
    'AVMediaType' (aka 'NSString') has no member 'video'
                mediaType = AVMediaType.video
                            ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:50:25: error: type
    'AVMediaType' (aka 'NSString') has no member 'audio'
                mediaType = AVMediaType.audio
                            ^~~~~~~~~~~ ~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/strategies/AudioVideoPermissionStrategy.swift:56:44: error:
    'AVMediaType' (aka 'NSString') is not implicitly convertible to 'String!'; did you mean to use 'as' to explicitly convert?
            AVCaptureDevice.requestAccess(for: mediaType, completionHandler: {
                                               ^
                                                         as String!
    === BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:94:118: error: 'OpenExternalURLOptionsKey' is
    not a member type of 'UIApplication'
    fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
                                                                                                           ~~~~~~~~~~~~~ ^
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:55:77: error: type 'UIApplication' has no
    member 'openSettingsURLString'
                    let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
                                                                                ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~

Any help is greatly appreciated. Thanks for making permission handling easier for the rest of us! :)

  • 📱 iOS
  • 🤖 Android
@iambudi
Copy link

iambudi commented Nov 27, 2018

Can not build as well

.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.1/ios/Classes/PermissionManager.swift:95:54: error: closure tuple parameter '(key: String, value: Any)' does not support destructuring
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
^~~~~~~~~~
(arg) -> <#Result#> let (key, value) = arg; return
Could not build the application for the simulator.
Error launching application on iPhone X.

@mvanbeusekom
Copy link
Member

@simongomez95, @iambudi, with the latest version of iOS, Apple has changed one of the methods used to open the AppSettings causing this build to fail. I will correct that today and put out a new release (2.1.2).

martijn00 added a commit that referenced this issue Nov 27, 2018
Fix build error on latest Xcode (iOS 12)
@mvanbeusekom
Copy link
Member

@simongomez95, @iambudi, we just released version 2.1.2 of the permission_hanlder plugin which should resolve this issue.

@simongomez95
Copy link
Author

Just updated the plugin, build still fails with

    === BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:98:118: error: 'OpenExternalURLOptionsKey' is
    not a member type of 'UIApplication'
    fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
                                                                                                           ~~~~~~~~~~~~~ ^
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:50:45: error: type 'UIApplication' has no
    member 'openSettingsURLString'
                    guard let url = URL(string: UIApplication.openSettingsURLString),
                                                ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:55:45: error: type 'UIApplication' has no
    member 'OpenExternalURLOptionsKey'
                    let optionsKeyDictionary = [UIApplication.OpenExternalURLOptionsKey(rawValue: "universalLinksOnly"): NSNumber(value: true)]
                                                ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/nekothecat/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:59:77: error: type 'UIApplication' has no
    member 'openSettingsURLString'
                    let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
                                                                                ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~

Am I maybe doing something wrong?

@mvanbeusekom
Copy link
Member

@simongomez95, which version of Xcode are you using? It should be at least 10.1

I will re-open the issue for now, please let me know.

@mvanbeusekom mvanbeusekom reopened this Nov 27, 2018
@simongomez95
Copy link
Author

I have 9.2, that's probably it. Thanks!

@smokinguns
Copy link

I'm having the same issue. I'm trying to use 2.1.2 and I'm using 10.1. I've done a clean and upgrade on packages. Any thoughts?

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

Successfully merging a pull request may close this issue.

4 participants