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

build failed in Xcode 9.0GM with Swift 4.0 #182

Closed
YaoJuan opened this Issue Sep 22, 2017 · 11 comments

Comments

Projects
None yet
9 participants
@YaoJuan

YaoJuan commented Sep 22, 2017

No description provided.

@Daltron

This comment has been minimized.

Show comment
Hide comment
@Daltron

Daltron Sep 25, 2017

As a temporary workaround, if you are using CocoaPods, you can do this:

  1. Request specific versions in your Podfile. By default, installing the FacebookCore pod also installs the FBSDKCoreKit pod, and installing the FacebookShare pod also installs the FBSDKShareKit pod and so on and so on..
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
pod 'FBSDKCoreKit', '~> 4.21.0'
pod 'FBSDKLoginKit', '~> 4.21.0'
pod 'FBSDKShareKit', '~> 4.21.0'

They key is pointing the FBSDK pods to the 4.21.0 version.

  1. Telling your pod file to compile the Facebook pods into Swift 3.2 if your project is compiled in Swift 4
post_install do |installer|
    installer.pods_project.targets.each do |target|
        facebook_pods = ['FacebookCore', 'FacebookLogin', 'FacebookShare']
        if facebook_pods.include? target.name
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end
end

There is no need to include the FBSDK pods in the array to check for as they are written in Objective-C

Daltron commented Sep 25, 2017

As a temporary workaround, if you are using CocoaPods, you can do this:

  1. Request specific versions in your Podfile. By default, installing the FacebookCore pod also installs the FBSDKCoreKit pod, and installing the FacebookShare pod also installs the FBSDKShareKit pod and so on and so on..
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
pod 'FBSDKCoreKit', '~> 4.21.0'
pod 'FBSDKLoginKit', '~> 4.21.0'
pod 'FBSDKShareKit', '~> 4.21.0'

They key is pointing the FBSDK pods to the 4.21.0 version.

  1. Telling your pod file to compile the Facebook pods into Swift 3.2 if your project is compiled in Swift 4
post_install do |installer|
    installer.pods_project.targets.each do |target|
        facebook_pods = ['FacebookCore', 'FacebookLogin', 'FacebookShare']
        if facebook_pods.include? target.name
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end
end

There is no need to include the FBSDK pods in the array to check for as they are written in Objective-C

@kristofk

This comment has been minimized.

Show comment
Hide comment
@kristofk

kristofk Sep 27, 2017

I collected all the errors and fixes and created this tutorial on compiling the Swift SDK in Swift 4

kristofk commented Sep 27, 2017

I collected all the errors and fixes and created this tutorial on compiling the Swift SDK in Swift 4

@lawgimenez

This comment has been minimized.

Show comment
Hide comment
@lawgimenez

lawgimenez Sep 29, 2017

Is Facebook planning to update this SDK soon?

lawgimenez commented Sep 29, 2017

Is Facebook planning to update this SDK soon?

@wvdk

This comment has been minimized.

Show comment
Hide comment
@wvdk

wvdk Sep 29, 2017

Another option is to use the other sdk instead. https://github.com/facebook/facebook-sdk-swift

  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'
  pod 'FBSDKShareKit'

It's built with Objective-C so it doesn't care what Swift compiler you're using. :)

wvdk commented Sep 29, 2017

Another option is to use the other sdk instead. https://github.com/facebook/facebook-sdk-swift

  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'
  pod 'FBSDKShareKit'

It's built with Objective-C so it doesn't care what Swift compiler you're using. :)

@kristofk

This comment has been minimized.

Show comment
Hide comment
@kristofk

kristofk Sep 30, 2017

@wvdk Yes you could use it, it's an older SDK that has been thoroughly tested, and it's the one Facebook recommends. However, I'd personally want to have as much of my codebase in Swift as possible which would be the point of this SDK as it does the exact same thing.

kristofk commented Sep 30, 2017

@wvdk Yes you could use it, it's an older SDK that has been thoroughly tested, and it's the one Facebook recommends. However, I'd personally want to have as much of my codebase in Swift as possible which would be the point of this SDK as it does the exact same thing.

@gfosco

This comment has been minimized.

Show comment
Hide comment
@gfosco

gfosco Oct 6, 2017

Contributor

Coming soon, hopefully monday (no guarantee), a new build of the obj-c sdk and a full swift 4 update for the swift-sdk. Hang in there.

Contributor

gfosco commented Oct 6, 2017

Coming soon, hopefully monday (no guarantee), a new build of the obj-c sdk and a full swift 4 update for the swift-sdk. Hang in there.

@foghel

This comment has been minimized.

Show comment
Hide comment
@foghel

foghel Oct 10, 2017

Hi, Any news regarding the swift4 Update ?
Thanks.

foghel commented Oct 10, 2017

Hi, Any news regarding the swift4 Update ?
Thanks.

@cdinarte

This comment has been minimized.

Show comment
Hide comment
@cdinarte

cdinarte Oct 10, 2017

There's a pull request already.

#184

cdinarte commented Oct 10, 2017

There's a pull request already.

#184

@gfosco

This comment has been minimized.

Show comment
Hide comment
@gfosco

gfosco Oct 10, 2017

Contributor

Just waiting on the hotfix for the obj-c SDK.

Contributor

gfosco commented Oct 10, 2017

Just waiting on the hotfix for the obj-c SDK.

@rlinyard

This comment has been minimized.

Show comment
Hide comment
@rlinyard

rlinyard Oct 11, 2017

Is there any ETA for the hotfix? Like others, I would like to move forward with the Swift version of the SDK but am stuck in Swift 4 without this.

rlinyard commented Oct 11, 2017

Is there any ETA for the hotfix? Like others, I would like to move forward with the Swift version of the SDK but am stuck in Swift 4 without this.

@gfosco

This comment has been minimized.

Show comment
Hide comment
@gfosco

gfosco Oct 12, 2017

Contributor

0.3.0 has landed and the pod is being published, everything should be good to go momentarily!

Contributor

gfosco commented Oct 12, 2017

0.3.0 has landed and the pod is being published, everything should be good to go momentarily!

@gfosco gfosco closed this Oct 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment