AlamoFire + SwiftyJSON on iOS 9.0 - cocoapods

I have been trying to install and use AlamoFire and SwiftyJSON on iOS 9 using CocoaPods. The latest version keeps getting installed and it is not compatible with iOS 9.0.
My PodFile looks like this:
platform :ios, '9.0'
use_frameworks!
target 'Kitchology' do
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'AlamofireImage'
end
I tried commenting them out and doing a pod install to remove them, then put them back in and do another pod install. Every time the latest is installed.
I do have the project itself set to iOS 9.0 and NOT iOS 9.3 for the project build on all versions.

Figured this one out. I deleted the pods by commenting them out and running pod update. Then we deleted the workspace. Then comes the main part of the solution - we deleted everything in the derived data folder. You can find this location in Xcode->Preferences Locations. Although a clean should delete this data, it obviously did not.
Now we recreate the pods again. Do a pod init, add the pods back into the Podfile and do a pod install. Open the workspace and everything was then good.
This was a problem with cached data in Xcode.

Related

Swift Package Manager and Cocoapods together: Compiler errors in Swift Package after Cocoapod Pod addition

I am developing an iOS app using the ParseSwift SDK. When I set up my project I added ParseSwift via the Swift Package Manager, which worked like a charm. Server connection and saving and querying for data on the server all works and my app compiles in its current state.
To add online meeting capabilities I have been trying to add the JitsiMeet iOS SDK.
After trying to add it via Swift Package Manager, I read on the Jitsi forum that the preferred way of adding it to an existing project is via Cocoapods, and there are currently no plans of supporting the Swift Package Manager. After finding several questions about interoperability of SPM and Cocoapods here I was hoping it would be smooth sailing.
After some back and forth to make Cocoapods work with my M1, I then tried several different Podfile variants to successfully add the JitsiMeetSDK Pod to my project. These variants include:
adding or leaving out the platform part so it is assigned by Cocoapods
adding or leaving out use_frameworks!
installing with or without the post_install block (which is taken from the Jitsi documentation)
This is my Podfile:
platform :ios, '15.0'
target 'MyApp' do
use_frameworks!
pod 'JitsiMeetSDK'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
The short version is: this does not work. My app doesn't compile anymore.
Here is the strange part: while Cocoapods successfully adds the JitsiMeetSDK Pod, when I open the .xcworkspace file and try to compile it I now get tons of compiler warnings for the ParseSwift package that I added via the Swift Package Manager. These errors all concern Concurrency or features only available in iOS 15 - which should not be a problem, since I set the platform to ios, '15.0' in my Podfile.
The ParseSwift files are also annotated and do have checks for Concurrency, which is why I understand this error even less. (screenshots of compiler errors and annotations below)
Is there an order that I have to follow when it comes to adding packages (first Cocoapods, then SPM)? Or any App settings I need to change now that two package managers are in the mix? Any help is appreciated!
I am using
Xcode 13.1
Swift version 5.5.1 (arm64)
Cocoapods 1.11.2 (installed via Home-brew for M1 support)
ParseSwift SDK 2.5.0 (via SPM)
JitsiMeet SDK 4.0.0 (via Cocoapods)
Here is a screenshot of the error messages (one example of almost 300 such cases):
So, I used your Podfile with a new project and ended up with the exact same result.
Then I tried first run Cocoapods for JitsiMeetSDK, then adding the ParseSwift with SPM. Same result.
The only way I was able to make it work was by having Cocoapods install both ParseSwift and JitsiMeetSDK.
platform :ios, '15.0'
target 'TestPackageManagers (iOS)' do
use_frameworks!
pod 'JitsiMeetSDK'
pod 'ParseSwift'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
pod install ran like a charm and I was able to compile and run everything.
You mentioned you are using ParseSwift SDK 2.5.0 in Xcode 13.1. This isn't possible.
Xcode made changes related to backwards compatibility in Xcode 13.2+.
You can resolve everything easily by upgrading to Xcode 13.2+. If you look at the release notes for ParseSwift it says specifically:
Requires Xcode 13.2 or above to use async/await. Not compatible with Xcode 13.0/1, will need to upgrade to 13.2+. Still works with Xcode 11/12
Basically, ParseSwift 2.4.0+ requires Xcode 13.2+. If you want to use Xcode 13.1 or lower, you need to use ParseSwift 2.3.1 or lower. More info can be found in the PR that made the change.
You will face this same issue with any dependency that adds the async/await backwards compatibility for iOS13, so it's recommended to upgrade to Xcode 13.2+ sooner than later.
In addition, the problem isn't related to a mix of SPM and Cocoapods, these dependency managers have nothing to do with each other and you shouldn't have any issues using ParseSwift through SPM along with others in Cocoapods.
The described Concurrency errors were due to updating the ParseSwift package dependencies without updating Xcode to 13.2+ as #CoreyB pointed out.
Xcode 13.2 introduced other, unrelated bugs to my project but solved the Concurrency issue. The bugs were an Xcode 13.2 issue, and updating to Xcode 13.2.1 fixed these bugs.
After the update, I was able to add JitsiMeetSDK via Cocoapods to my existing project.
Thanks to #CoreyB and #Alex Kusmenkovsky for their helpful input!

Firebase Unity project fails to find BoringSSL-GRPC library during Xcode build

I'm attempting to compile a Xcode .xcworkspace built by Unity that contains Google Firebase. I tried all the solutions I could find online without any luck. If you have any ideas I can try, can you please share?
The error I'm getting is that it can't find the BoringSSL-GRPC library. I tried running pod update and pod install to resolve this and I can see while it does successfully install BoringSSL-GRPC (0.0.7), Xcode still gives this error even if I open the .xcworkspace file.
ld: library not found for -lBoringSSL-GRPC
When I add use_frameworks! to the podfile per a suggestion online, I get this error:
ld: framework not found FBLPromises
When I removed the above and then add use_modular_headers! per another suggestion, I get this error:
fatal error: module map file '/Users/xxx/Documents/Builds/DemoProj/Pods/Headers/Private/grpc/gRPC-Core.modulemap' not found
Each time, I changed the podfile, I'd run pod update and pod install before doing a clean build in Xcode.
Here are the versions I'm using:
macOS Catalina 10.15.6
Unity 2019.4.4f1
Firebase 6.15.2
Xcode 11.6 (11E708)
CocoaPods 1.9.3
And here is my podfile:
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'UnityFramework' do
pod 'Firebase/Core', '6.24.0'
pod 'Firebase/Analytics', '6.24.0'
pod 'Firebase/RemoteConfig', '6.24.0'
pod 'FirebaseCrashlytics', '4.1.0'
pod 'FirebaseFirestore', '1.15.0'
end
Notes:
I've also tried adding ,:modular_headers => true at the end of each pod which didn't work.
I have a paid developer account and Xcode is configured for that account

Problem submitting to testflight with 4.8.1

I upgraded both the DJISDK and DJIUXSDK to v4.8.1, the builds are working as expected, but when I try to submit the solution to testflight I get a complaint about DJIUXSDK.framework/Assets.car. I have not done any modifications of the Assets.
Invalid Bundle. The asset catalog at 'Payload/mydjiapp.app/Frameworks/DJIUXSDK.framework/Assets.car' can't be processed. Rebuild your app, and all included extensions and frameworks, with the latest GM version of Xcode and resubmit.
I am building the solution with Xcode 10.1.
My podfile:
target 'mydjiapp' do
use_frameworks!
# Pods for mobilegroundstation
pod 'DJI-SDK-iOS', '4.8.1'
pod 'DJI-UXSDK-iOS', '4.8.1'
pod 'DJIWidget', '~> 1.2'
end
Is there any obvious solution to this that I am missing?

Xcode 7.2 not loading classes in libraries installed through Cocoapods

I've started a new iOS project in Xcode and have tried installing some common swift packages like SwiftyJSON and Alamofire through cocoapods. The pods install successfully and the full libraries show up under the root project directory, but whenever I attempt to import them into my project Xcode returns a "No such module.." error.
What I've already done:
- I've cleaned and rebuilt the project
- I've ensured that I'm using the .xcworkspace file after installing the cocoapods
- I've rebooted my mac and xcode
- I've tried linking the binaries in the "build phases" tab in the project settings
- I've tried building the project once before installing pods
All to no avail. Here are the versions I'm using:
- El Capitan 10.11.2
- Xcode 7.2
- Cocoapods 0.39.0
Any and all help/suggestions towards what I may be doing wrong are greatly appreciated!
--EDIT (adding podfile)--
platform :ios, '8.0'
use_frameworks!
target 'newApp' do
pod 'Alamofire'
pod 'SwiftyJSON'
end
Try using the following as your podfile. After changing the podfile dont forget to run pod install.
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire'
pod 'SwiftyJSON'
You can add Alomofire: Project -> Target -> General -> Embedded Libraries -> + -> Alamofire.
As you see in picture:

CocoaPods v0.39.0 errors with Facebook SDK v4.7

Old Cocoapods Configuration
I am using Xcode 7 Beta 4. Initially I was using Cocoapods version 0.38.2 and when I ran pod install --verbose in Terminal it said it downloaded dependencies for Bolts, FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit, FBSDKMessengerShareKit, and Pods for iOS 8.1. With this setup my app compiled successfully. Below is the Podfile and Objective-C Bridging File that I used to import the Facebook SDK (so Swift recognises its referenced methods and Objective-C classes). Note that the specific versions shown in my Podfile are also the versions that get installed even if I do not explicitly specify them at the time of this writing.
Podfile
xcodeproj '/Users/<my_username>/MyApp/MyApp.xcodeproj'
pod "FBSDKCoreKit", "~> 4.7.0";
pod "FBSDKLoginKit", "~> 4.7.0";
pod "FBSDKShareKit", "~> 4.7.0";
pod "FBSDKMessengerShareKit", "~> 1.3.1";
MyAppObjCBridging.h
#ifndef MyAppObjCBridging_h
#define MyAppObjCBridging_h
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKMessengerShareKit/FBSDKMessengerShareKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#endif
Problems encountered when updating to Cocoapods v0.39.0 (from v0.38.2)
The console showed the message "CocoaPods 0.39.0 is available. To update use: gem install cocoapods. Until we reach version 1.0 the features of CocoaPods can and will change. We strongly recommend that you use the latest version at all times.", so I installed the this latest version of Cocoapods 0.39.0 by executing sudo gem install cocoapods in Terminal.
But when I compiled my app it gave me the following errors:
/Users//MyApp/MyApp/MyAppObjCBridging.h:14:9: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found
In Xcode I "Product > Clean" (CMD+SHIFT+K), but this did not make any difference. So I ran sudo gem uninstall cocoapods in Terminal (which listed 0.38.2 and 0.39.0 as the versions that were currently installed) and selected version 0.39.0 from the list to uninstall the latest version and revert back to 0.38.2. I then ran pod install --verbose. When I tried to compile my app it compiled successfully and ran in Simulator again.
Question 1
Why does it give the error that it can't find "FBSDKCoreKit/FBSDKCoreKit.h" when I use Cocoapods version 0.39.0 instead of the older version 0.38.2?
Question 2
If when using Cocoapods version 0.38.2 (the version that compiles with my app) I decided to add platform :ios, '9.0' to the first line of my Podfile (above its existing contents) and run pod install --verbose in Terminal, the Terminal messages tell me that it installs each pod target for iOS 9.0 (instead of iOS 8.1) (i.e. - Installing targetFBSDKCoreKitiOS 9.0).
When I then run my app it successfully compiles and opens in Simulator and displays some new warnings associated with iOS9, most of which I understand. However I do not understand why this one appears. Why is this warning appearing?:
ld: warning: directory not found for option '-L/Users/Ls/code/swift/FreeWifiSearch/FreeWifiSearch/build/Debug-iphoneos'
Question 3
When using Cocoapods version 0.38.2 (the version that compiles with my app), if I decided to add use_frameworks! to the first line of my Podfile, and platform :ios, '9.0' to the second line of my Podfile (above its existing contents), and then run pod install --verbose in Terminal, the Terminal messages tell me that it installs each pod target for iOS 9.0 (instead of iOS 8.1).
When I then run my app the following errors appear:
Use of unresolved identifier 'FBSDKLoginButton'
Use of unresolved identifier 'FBSDKLoginManager'
Use of unresolved identifier 'FBSDKLoginBehaviour'
Why does adding use_frameworks! to the top of my Podfile prevent me from using the Facebook SDK identifiers? (noting that when I don't have use_frameworks! at the top of my Podfile my app successfully compiles and runs in Xcode Simulator, and I can successfully retrieve a Facebook SDK Access Token and login to Facebook)
Since posting the original questions the following was performed and resulted in no compiler errors:
Updated from Xcode 7 Beta 4 to Xcode 7.1.1 by downloading latest from App Store
Added use_frameworks! and platform :ios, '9.0' to top of Podfile
Changed deployment target to iOS 9.0: Project Settings > Targets > General > Deployment Info > Deployment Target > 9.0
Updated CocoaPods to v0.39 with sudo gem install cocoapods
Reinstalled pods with pod update --verbose
Added import FBSDKLoginKit above the class containing Facebook SDK methods
Performed Clean (Shift+CMD+K) and Run (CMD+R) in Xcode to test on device
Add "${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit" in your target's Header Search Paths in Build Settings
For me it's OK now(CocoaPods 0.39, FBSDK 4.10)

Resources