Facebook-sdk-for-unity: Empty Unity project doesn't build in xcode

Created on 16 Jan 2020  路  13Comments  路  Source: facebook/facebook-sdk-for-unity

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Unity Editor Version: 2019.2.17
  • Unity SDK Version: 7.18.0
  • Installation Platform & Verison: [iOS] version 5.0.2 ???

Goals

What do you want to achieve?
Build an empty project with Facebook SDK integrated to an iOS device

Expected Results

What do you expect to happen?
Build without errors

Actual Results

Getting 13 errors at xcode archive step

What actually happened? Can you provide a stack trace?
/Users/USER_NAME/Desktop/FB/Pods/Headers/Public/FBSDKShareKit/FBSDKShareKit/FBSDKHashtag.h:33:37: Cannot find protocol declaration for 'FBSDKCopying'; did you mean 'NSCopying'?

/Users/USER_NAME/Desktop/FB/Pods/Headers/Public/FBSDKShareKit/FBSDKShareKit/FBSDKShareOpenGraphObject.h:51:75: Cannot find protocol declaration for 'FBSDKCopying'; did you mean 'NSCopying'?

/Users/USER_NAME/Desktop/FB/Pods/Headers/Public/FBSDKShareKit/FBSDKShareKit/FBSDKSharingContent.h:37:32: Cannot find protocol declaration for 'FBSDKCopying'; did you mean 'NSCopying'?
.......

AND SO ON, but these are the first errors I get

Steps to Reproduce

What are the steps necessary to reproduce this issue?

  1. Create empty project
  2. Import latest Facebook SDK
  3. Add examples scenes to build settings scenes list
  4. Export xcode project on Mac
  5. Open xcode project (workspace file), select required provisioning profile and archive (Project -> Archive)
  6. After a few minutes you will get these errors

Code Samples & Details

No code samples because the project is empty.

Seems like something wrong with Cocoapods execution.

Thanks!

bug

All 13 comments

I can also confirm this issue with iOS SDK 5.14.0. Version 5.13.1 seems to work just fine.

To fix this I had to change the dependencies file in Unity from this:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[5,6)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[5,6)" />
        <androidPackage spec="com.facebook.android:facebook-login:[5,6)" />
        <androidPackage spec="com.facebook.android:facebook-share:[5,6)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit" version="~> 5.2" />
        <iosPod name="FBSDKLoginKit" version="~> 5.2" />
        <iosPod name="FBSDKShareKit" version="~> 5.2" />
    </iosPods>
</dependencies>

TO THIS:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[5,6)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[5,6)" />
        <androidPackage spec="com.facebook.android:facebook-login:[5,6)" />
        <androidPackage spec="com.facebook.android:facebook-share:[5,6)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit" version="~> 5.8.0" />
        <iosPod name="FBSDKLoginKit" version="~> 5.8.0" />
        <iosPod name="FBSDKShareKit" version="~> 5.8.0" />
    </iosPods>
</dependencies>

Same problem here,
changing the dependencies did not fix the problem.

Same problem here,
changing the dependencies did not fix the problem.

Check your PodFile after Unity exports the project, also update your cocoapods and restart your mac and build again if it doesnt help

Command to update your pods - sudo gem install cocoapods

It worked thanks!

Same problem here,
changing the dependencies did not fix the problem.

Check my other solution, maybe it will help you aswell :)

Aaaaand this solution doesn't work anymore, perfect!

I also have this exact same problem. Been 20 days or so since I made a build for iOS, I've changed nothing.

Updating cocoapods did not solve it

This issue happend with FBSDK 5.14 for iOS. Try either do the following to use 5.13 instead:

  1. Change the FBSDK version to 5.13 in "Dependencies.xml" in the folder FacebookSDK/Plugins/Editor:
<iosPod name="FBSDKCoreKit" version="5.13" />
<iosPod name="FBSDKLoginKit" version="5.13" />
<iosPod name="FBSDKShareKit" version="5.13" />
  1. In Xcode project, change the FBSDK to 5.13 in the "Podfile" to the following and run "pod install" in the command line inside Xcode project folder
pod 'FBSDKCoreKit', '5.13'
pod 'FBSDKLoginKit', '5.13'
pod 'FBSDKShareKit', '5.13'

This issue happend with FBSDK 5.14 for iOS. Try either do the following to use 5.13 instead:

  1. Change the FBSDK version to 5.13 in "Dependencies.xml" in the folder FacebookSDK/Plugins/Editor:
<iosPod name="FBSDKCoreKit" version="5.13" />
<iosPod name="FBSDKLoginKit" version="5.13" />
<iosPod name="FBSDKShareKit" version="5.13" />
  1. In Xcode project, change the FBSDK to 5.13 in the "Podfile" to the following and run "pod install" in the command line inside Xcode project folder
pod 'FBSDKCoreKit', '5.13'
pod 'FBSDKLoginKit', '5.13'
pod 'FBSDKShareKit', '5.13'

Unfortunately that didn't work for me. I edited my dependencies script in unity as you mentioned

iosPods
    iosPod name="FBSDKCoreKit" version="~> 5.13" 
    iosPod name="FBSDKLoginKit" version="~> 5.13" 
    iosPod name="FBSDKShareKit" version="~> 5.13" 
iosPods

@Fudds The latest 5.15 has fixed this issue. Just run "pod repo update" before exporting XCode to build.

@jzhudev pod repo update brought it to 5.15 and fixed my problem.

Thanks for the help!

@Fudds The latest 5.15 has fixed this issue. Just run "pod repo update" before exporting XCode to build.

Yes! This solved the problem. Thank you so much. (note: after running repo update I had to export from Unity again)

Thanks for all the help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michelleran picture michelleran  路  6Comments

edscodeblenders picture edscodeblenders  路  4Comments

Shaitan1805 picture Shaitan1805  路  6Comments

derwaldgeist picture derwaldgeist  路  4Comments

JuGGerNaunT picture JuGGerNaunT  路  3Comments