CocoaPods with Dynamic Frameworks - ios

Assume the following setup:
A Swift project with a main target that links two dynamic Cocoa Touch Framework targets.
MainProject
MainTarget
FrameworkA
FrameworkB
Conditions:
Framework A links CocoaPodM.
Framework B links CocoaPodN.
The test target for the main target and FrameworkA require the Pod CocoaPodTestLoggingX.
The test target for the FrameworkB requires the Pod CocoaPodTestLoggingY.
Is the following Podfile correct?
platform :ios, '8.0'
use_frameworks!
target 'MainTarget' do
pod 'CocoaPodM', '~> 1.0'
pod 'CocoaPodN', '~> 1.0'
target 'MainTarget Tests' do
inherit! :search_paths
pod 'CocoaPodTestLoggingX', '~> 1.0'
end
end
target 'FrameworkA' do
pod 'CocoaPodM', '~> 1.0'
target 'FrameworkATests' do
inherit! :search_paths
pod 'CocoaPodTestLoggingX', '~> 1.0'
end
end
target 'FrameworkB' do
pod 'CocoaPodN', '~> 1.0'
target 'FrameworkBTests' do
inherit! :search_paths
pod 'CocoaPodTestLoggingY', '~> 1.0'
end
end
To be more specific:
When a framework uses a Pod: Must it be linked also in the main target that uses the frameworks? Keep in mind a standalone build of the framework to be used in a different project. I assume the external Pod is physically only included in the app and not in both, the app and the framework.
The same question for tests when running the whole test set from the main target and all test targets are included in the scheme.

Related

Cocoapods not setting search paths correctly

I opened an iOS (Swift) project today I hadn't touched for a while and it wouldn't build. The first import statement for a Cocoapods framework was throwing a No such module compile error in Xcode. Changing the order of import statements made the error throw on whichever was the first external dependency in my import list.
I fixed this by adding each of my Cocoapods to Framework Search Paths in my project's main target (it has a few targets, including tests, a share extension, and a framework of shared code for the app and extension). These search paths were empty and now look like this:
After doing that the project built fine, but now I'm getting this SIGABRT error every time I try to run the app (both on simulator and device):
dyld: Library not loaded: #rpath/CocoaLumberjack.framework/CocoaLumberjack
Referenced from: [path removed]
Reason: image not found
My guess is this is to do with CocoaLumberjack needing to be linked somewhere else/some other way because of its macros but I don't really know.
I've also tried running pod install, cleaning the build folder and deleting derived data, and running pod deintegrate + pod install with no success.
Is it possible to get Cocoapods to automatically set up my search paths correctly so I don't have these issues? Or is there a manual step I'm missing or have done wrong perhaps?
Edited to add my Podfile:
platform :ios, '11.0'
use_frameworks!
# ignore all warnings from all pods
inhibit_all_warnings!
# This is my shared framework, used by both my app and share extension
target 'XXXShared' do
pod 'SnapKit', '~> 4.0'
pod 'KeychainSwift', '~> 7.0'
pod 'Reveal-SDK', :configurations => ['Debug']
pod 'IQKeyboardManagerSwift'
pod 'APESuperHUD', :git => 'https://github.com/apegroup/APESuperHUD.git'
pod 'WSTagsField', '~> 3.1'
pod 'Cache', '~> 4.2'
pod 'TableKit', '~> 2.5'
pod 'GRDB.swift', '~> 3.2'
pod 'PromiseKit', '~> 6.0'
pod 'Toast-Swift', '~> 3.0.1'
pod 'CocoaLumberjack/Swift'
pod 'CollectionKit'
pod 'PinLayout'
pod 'FlexLayout'
pod 'LayoutKit'
pod 'PromiseKit/Alamofire'
pod 'Alamofire', '~> 4.7'
end
target 'XXX' do
pod 'Reveal-SDK', :configurations => ['Debug']
end
target 'XXX share extension' do
inherit! :search_paths
end
Edited to add screenshots:

iOS Error loading your issues in Firebase Crashlytics dashboard

Firebase Crashlytics dashboard error
In my Firebase Crashlytics console, I can not see my crash reports. It is saying Error loading.See the above picture for details.
My Podfile:
platform :ios, '9.0'
target 'myproject' do
# Comment the next line if you're not using Swift and don't want to use
dynamic frameworks
use_frameworks!
pod 'DatePickerDialog'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'SQLite.swift', '~> 0.11.5'
pod 'SwiftyJSON', '~> 4.1.0'
pod 'nanopb'
pod 'Fabric', '~> 1.7.11'
pod 'Crashlytics', '~> 3.10.7'
# Pods for myproject
target 'myprojectTests' do
inherit! :search_paths
# Pods for testing
end
target 'myprojectUITests' do
inherit! :search_paths
# Pods for testing
end
end
I know this seems stupid but have you tried going to Firebase support?
Mike from Firebase here. Please contact our support team via https://firebase.google.com/support/ and include any errors you see from Developers Tools -> Console.

Integrating Firebase inside a framework with Cocoapods

I'm trying to include Firebase inside a framework target thats linked to an Application. When I just include Firebase to the framework target, it wont compile the App and when I include Firebase to both App and the framework, I'm seeing the following warnings.
objc[25463]: Class FIRAAppEnvironmentUtil is implemented in both /Users/User/Library/Developer/Xcode/DerivedData/TestApp-bldxbgfroizmdggroxupwpsxowvt/Build/Products/Debug-iphonesimulator/AppUIKit.framework/AppUIKit (0x109078e98) and /Users/User/Library/Developer/Xcode/DerivedData/TestApp-bldxbgfroizmdggroxupwpsxowvt/Build/Products/Debug-iphonesimulator/AppKit.framework/AppKit (0x108effdb8). One of the two will be used. Which one is undefined.
Following is my Pod file
platform :ios, '9.0'
pod 'Firebase', '~> 3.6'
pod 'Firebase/RemoteConfig', '~> 3.6'
target 'AppKit' do
use_frameworks!
pod 'Alamofire', '~> 4.0'
target 'AppKitTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'AppUIKit' do
use_frameworks!
# Pods for AppUIKit
target 'AppUIKitTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'TestApp' do
use_frameworks!
# Pods for TestApp
target 'TestAppTests' do
inherit! :search_paths
# Pods for testing
end
end

Alamofire cocoapod integration issue in XCTest

I have integrated Alamofire in my ios project.While am testing my app using XCTest(UITest),am getting the following issue.I have googled and tried all the solutions.But not getting the solutions.Plesae help me to solve this.
Library not loaded: #rpath/Alamofire.framework/Alamofire Referenced from: /private/var/mobile/Containers/Bundle/Application/DA4702F0-6A4C-4EB6-99D0-255ABB6E3F57/Real Estate.app/Real Estate Reason: image not found Dyld Version: 353.12
this is my podfile.
target 'FreshBoss' do
use_frameworks!
# Pods for FreshBoss
pod 'Alamofire', '~> 3.4'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'Google/SignIn'
target 'FreshBossTests' do
inherit! :search_paths
# Pods for testing
pod 'Alamofire', '~> 3.4'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'Google/SignIn'
end
target 'FreshBossUITests' do
inherit! :search_paths
# Pods for testing
pod 'Alamofire', '~> 3.4'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'Google/SignIn'
end
end
Embed Pods framework is the reason for this.UITest -> Buildphases ->
Embed Pods framework is missing.Copy from target and paste it in UITest target.It worked for me.

Too many errors after updating to Cocoapods 1.0

Good afternoon,
After updating to the latest version of Cocoapods (1.0) my iOS application shows a lot of errors. I'm not sure why is this happening because during the update everything was correct, but when I "Run" my app, it shows the following errors:
And that's my Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'myApp' do
pod 'HanekeSwift', '~> 0.10'
pod 'Alamofire', '~> 3.3'
pod 'SwiftyJSON', '~> 2.3'
pod 'Batch', '~> 1.5'
end
target 'myAppTests' do
end
target 'myAppUITests' do
end
What can I do in order to solve those problems?
Much appreciated,
Regards.
If you ran pod install and its still not working.
Try pod deintegrate and then pod install. It should fix the issue.
If someone has the same problem, I have deleted the old Podfile and create a new one. And now that's how it looks like:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'myApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for myApp
pod 'Alamofire', '~> 3.4'
pod 'SwiftyJSON', '~> 2.3'
pod 'HanekeSwift', '~> 0.10'
pod 'Batch', '~> 1.5'
target 'myAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'myAppUITests' do
inherit! :search_paths
# Pods for testing
end
end

Resources