Integrating Firebase inside a framework with Cocoapods - ios

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

Related

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.

UITest bundle could not be loaded

When i run the UITest in my phone it installs and runs as a separate app while giving the following error.
2017-07-27 10:44:33.892639+0700 XCTRunner[11886:3502890] Running
tests... 2017-07-27 10:44:34.137927+0700 XCTRunner[11886:3502890] The
bundle “...UITests” couldn’t be loaded because it is damaged or
missing necessary resources. Try reinstalling the bundle. 2017-07-27
10:44:34.137999+0700 XCTRunner[11886:3502890]
(dlopen_preflight(/var/containers/Bundle/Application/75C9B589-CCD4-480D-9E23-BA86878E8B37/...UITests-Runner.app/PlugIns/...UITests.xctest/...UITests):
Library not loaded:
#rpath/GoogleToolboxForMac.framework/GoogleToolboxForMac Referenced
from:
/var/containers/Bundle/Application/75C9B589-CCD4-480D-9E23-BA86878E8B37/...UITests-Runner.app/PlugIns/...UITests.xctest/...UITests
Reason: image not found)
I am trying to find a solution for this problem more than a day.
I wanted to add UITests to my existing app and added UITest target to my app. I am using both carthage and cocoa-pod. I updated pod file and updated pod then i added frameworks to the UITest target which are installed by carthage.
This is my pod file
platform :ios, '9.0'
use_frameworks!
target 'ExampleApp' do
pod 'Charts'
pod 'ReachabilitySwift', '~> 3'
pod 'Fabric'
pod 'Crashlytics'
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end
target 'ExampleAppTests' do
pod 'Charts'
pod 'ReachabilitySwift', '~> 3'
pod 'Fabric'
pod 'Crashlytics'
end
target 'ExampleAppUITests' do
pod 'Charts'
pod 'ReachabilitySwift', '~> 3'
pod 'Fabric'
pod 'Crashlytics'
end
This is my cartfile
github "Alamofire/Alamofire" ~> 4.0
github "SwiftyJSON/SwiftyJSON" "3.0.0"
github "Friend-LGA/LGSideMenuController" ~> 1.0.0
github "TTTAttributedLabel/TTTAttributedLabel" ~> 1.13.4
github "MagicalPanda/MagicalRecord"
I could find a related question from stack overflow but unfortunately it was not helpful. can you please help me to add the UITest target to my project without a issue.
Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
use_frameworks!
def base_pods
pod 'FBSDKCoreKit', '4.24.0'
pod 'FBSDKLoginKit', '4.24.0'
pod 'FBSDKShareKit', '4.15.0'
pod 'FacebookCore', '0.2.0'
pod 'FacebookLogin', '0.2.0'
pod 'FacebookShare', '0.2.0'
end
target 'App' do
base_pods
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
target 'AppUITests' do
inherit! :complete
# Pods for UI testing
end
end
the line inherit! :complete is key here
and in settings for the UITest target
NEXT:
clear derived data
pod deintegrate && pod install

CocoaPods with Dynamic Frameworks

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.

How to solve this error like Invalid `Podfile` file: [!] Unsupported options `{:exclusive=>true}` for target

I clone the project fro from repository and this project podfile containing the version 0.39.0.When i tried pod install command then i always get the error like
Podfile file: [!] Unsupported options {:exclusive=>true} for target’. Podfile looks like the following
inhibit_all_warnings!
def shared_pods
pod 'AFNetworking', '~> 2.0'
pod 'Crashlytics'
end
target ‘product_DEV' do
shared_pods
end
target ‘productTests', :exclusive => true do
shared_pods
end
How to solve this issue? Please help me.
:exclusive => true do has been deprecated check out this migration guide.
try re-initing the pod file,so that you can have latest pod file.
Or try changing the pod file content to something like this,
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'product_DEV' do
use_frameworks!
pod 'AFNetworking', '~> 2.0'
pod 'Crashlytics'
target 'productTests' do
inherit! :search_paths
end
end
This is a bind shot, give it a try it may help,Check other reference ref1,ref2
Check ref2 abstract_target may help.
abstract_target 'DummyTarget' do
pod "..."
target 'App1' do
end
target 'App2' do
end
end

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