parse-community / Parse-SDK-iOS-OSX

The Apple SDK for Parse Platform (iOS, macOS, watchOS, tvOS)
https://parseplatform.org
Other
2.81k stars 864 forks source link

How to implement the SDK #1663

Closed mtrezza closed 1 year ago

mtrezza commented 1 year ago

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:

JohnRoxMySox23 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Closing as release 2.0.0 supports import via Swift Package Manager.