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

How to implement the SDK #1663

Closed
mtrezza opened this issue Sep 29, 2022 · 3 comments
Closed

How to implement the SDK #1663

mtrezza opened this issue Sep 29, 2022 · 3 comments
Labels
type:meta Non-code issue

Comments

@mtrezza
Copy link
Member

mtrezza commented Sep 29, 2022

TL;DR

The Parse ObjC SDK can officially only be implemented using carthage. All other ways are not officially supported anymore. See below for how to implement the SDK using carthage.

Issue

The Parse ObjC SDK has several build-issues when trying to add it via the usual ways. This is because it hasn't been updated according to changes in Xcode / framework requirements for a while:

Solution

We have an open issue for Swift Package Manager support. There have been attempts, but no pull request made it over the finish line. If you want to help, it would be very much appreciated. There are pull requests as proof of concepts where SPM is added, but they need refinement.

Implement using Carthage in Xcode 14

The following approach is currently known to work for Xcode 14 to build the iOS frameworks:

  1. Build with carthage using the xcframeworks flag:
    carthage update --use-xcframeworks --platform iOS
  2. Add the xcframework files Parse.xcframework and Bolts.xcframework to the project and choose "Embed and sign".
  3. Do not add a carthage build phase script and remove it if there is any, it isn't required anymore.

Important:

  • The ParseFacebookUtils and ParseTwitterUtils won't work because they seem to look for a fat file dependency which isn't available. However, these two frameworks are just convenience wrappers, if you need Facebook or Twitter authentication, use PFUser.linkWith().
  • The Parse ObjC SDK contains schemes for building both static and dynamic frameworks. That may cause issues with carthage. Carthage builds the schemes in somewhat random order. It's necessary that it builds the static framework first, then the dynamic framework. You want the frameworks to be dynamic, otherwise you experience an error about the signature version when trying to run your app on a real device. You can either run carthage a until the order is randomly correct, or run carthage update --use-xcframeworks --platform iOS once, then open the Parse SDK in Carthage/Checkouts with Xcode and delete the schemes for building the static frameworks, then run carthage build --use-xcframeworks --platform iOS.
@JohnRoxMySox23
Copy link

JohnRoxMySox23 commented Sep 29, 2022

Hi @mtrezza and thank you for this explanation and these steps. I tried to follow them but after running carthage update --use-xcframeworks, I can only find Bolts.xcframework in Carthage/Build, there is no Parse.xcframework file.

Here is the execution result in the console:

*** Fetching Parse-SDK-iOS-OSX
*** Fetching facebook-ios-sdk
*** Fetching Bolts-ObjC
*** Checking out Bolts-ObjC at "1.9.1"
*** Checking out Parse-SDK-iOS-OSX at "1.19.3"
*** Checking out facebook-ios-sdk at "v11.0.1"
*** xcodebuild output can be found in /var/folders/v2/yb_z9mzj2d170bzw0xrknx180000gn/T/carthage-xcodebuild.8Dgj1D.log
*** Downloading facebook-ios-sdk binary at "Facebook SDK v11.0.1"
*** Downloading Parse-SDK-iOS-OSX binary at "1.19.3"
*** Skipped installing facebook-ios-sdk binary due to the error:
"Incompatible Swift version - framework was built with 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28) and the local version is 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)."
Falling back to building from the source
*** Building scheme "Bolts-macOS" in Bolts.xcodeproj
*** Building scheme "Bolts-tvOS" in Bolts.xcodeproj
Could not find any available simulators for tvOS

My Cartfile only contains this line:

github "parse-community/Parse-SDK-iOS-OSX"

Thank you for your help

@mtrezza
Copy link
Member Author

mtrezza commented Sep 29, 2022

Could not find any available simulators for tvOS

You could try to install the tvOS simulators in Xcode and run carthage again. It's apparently missing a simulator. Alternatively, if you only need to build for iOS try carthage update --use-xcframeworks --platform iOS.

@mtrezza
Copy link
Member Author

mtrezza commented Jan 29, 2023

Closing as release 2.0.0 supports import via Swift Package Manager.

@mtrezza mtrezza closed this as completed Jan 29, 2023
@mtrezza mtrezza unpinned this issue Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:meta Non-code issue
Projects
None yet
Development

No branches or pull requests

2 participants