Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FacebookShare causing compiler error after update

I just ran pod update for my app, and now it won't compile, giving these issues from LinkShareContent.swift in FacebookShare.

Cannot assign to property: 'contentDescription' is a get-only property
Cannot assign to property: 'contentTitle' is a get-only property
Cannot assign to property: 'imageURL' is a get-only property

These were the Facebook-related lines in my pod update:

Installing FBSDKCoreKit 4.23.0 (was 4.22.0)
Installing FBSDKLoginKit 4.23.0 (was 4.22.0)
Installing FBSDKShareKit 4.23.0 (was 4.22.0)
Using FacebookCore (0.2.0)
Using FacebookLogin (0.2.0)
Using FacebookShare (0.2.0)

Does anyone know about this problem? Did I do something wrong?

like image 206
Jonathan Tuzman Avatar asked May 29 '17 17:05

Jonathan Tuzman


3 Answers

Regarding docs of FBSDKShareLinkContent these properties have been deprecated:

@deprecated contentDescription is deprecated from Graph API 2.9. For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations.

@deprecated contentTitle is deprecated from Graph API 2.9. For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations

@deprecated imageURL is deprecated from Graph API 2.9. For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations

You should probably use quote and contentURL instead of them.

As a temporary solution, you can unblock the file LinkShareContent.swift and directly remove above lines until Facebook releases any update.

like image 159
Ilya Ilin Avatar answered Nov 20 '22 15:11

Ilya Ilin


I do not think referencing Github user 1amageek's repo with

pod 'FacebookShare', :git => 'https://github.com/1amageek/facebook-sdk-swift'

is a good idea, 1amageek could be the most awesome developer in the world and still delete his/her fork of the Facebook Swift SDKs

Until fixed you should change your Podfile to

pod 'FacebookCore', '~> 0.2'
pod 'FacebookLogin', '~> 0.2'
pod 'FacebookShare', '~> 0.2'
pod 'FBSDKCoreKit', '~> 4.22.1'
pod 'FBSDKLoginKit', '~> 4.22.1'
pod 'FBSDKShareKit', '~> 4.22.1'

And run pod update again.

Note that this code is not adding "duplicate" pods (older FBSDK[Core etc] + newer Facebook[Core etc]), the code is just being completely explicit about the Pods you are installing. If you were to list only pods FacebookCore, FacebookLogin, and FacebookShare, the FBSDKs will be installed by Cocoapods as dependencies anyways.

Reference: https://github.com/facebook/facebook-sdk-swift/issues/157  

like image 35
Brian Ogden Avatar answered Nov 20 '22 15:11

Brian Ogden


Replace your Podfile content with this:

pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare', :git => 'https://github.com/1amageek/facebook-sdk-swift'
like image 21
Brigadier Avatar answered Nov 20 '22 13:11

Brigadier