I'm trying to build a iOS framework, to this, I'm using some dependencies and while building the framework project alone gives no error, when I install using CocoaPods in a demo app I get the following error Undefined symbol: _OBJC_CLASS_$_DFPRequest
.
So this is what I have in the framework:
Podfile
platform :ios, '10.0'
use_frameworks!
target 'mylib' do
pod 'PrebidMobile'
pod 'Google-Mobile-Ads-SDK'
pod 'mopub-ios-sdk'
pod 'GoogleAds-IMA-iOS-SDK'
end
MyLib.podspec
Pod::Spec.new do |s|
...
s.platform = :ios, "10.0"
s.swift_version = '5.0'
s.xcconfig = {
:LIBRARY_SEARCH_PATHS => '$(inherited)',
:OTHER_CFLAGS => '$(inherited)',
:OTHER_LDFLAGS => '$(inherited)',
:HEADER_SEARCH_PATHS => '$(inherited)',
:FRAMEWORK_SEARCH_PATHS => '$(inherited)'
}
s.framework = [
'CoreTelephony',
'SystemConfiguration',
'UIKit',
'Foundation'
]
s.subspec 'core' do |core|
core.source_files = 'Source/**/*.{h,m,swift}'
end
s.dependency 'PrebidMobile'
s.dependency 'Google-Mobile-Ads-SDK'
s.dependency 'mopub-ios-sdk'
s.dependency 'GoogleAds-IMA-iOS-SDK'
end
Banner.swift
import UIKit
import PrebidMobile
import GoogleMobileAds
import MoPub
enum BannerFormat: Int {
case html
case vast
}
class BannerController: UIViewController, GADBannerViewDelegate, MPAdViewDelegate {
@IBOutlet var appBannerView: UIView!
@IBOutlet var adServerLabel: UILabel!
var bannerFormat: BannerFormat = .html
var adServerName: String = ""
private var adUnit: AdUnit!
private let amRequest = DFPRequest()
private var amBanner: DFPBannerView!
private var mpBanner: MPAdView!
override func viewDidLoad() {
super.viewDidLoad()
adServerLabel.text = adServerName
}
override func viewDidDisappear(_ animated: Bool) {
adUnit?.stopAutoRefresh()
}
func viewControllerForPresentingModalView() -> UIViewController! {
return self
}
}
Now in the appdemo, I have
Podfile
platform :ios, '10.0'
use_frameworks!
target 'appdemo (iOS)' do
pod 'MyLib', :git => 'https://...mylib.git'
end
So, just by running pod install && pod update
and building the appdemo I already got the error.
Since running the framework alone works, what am I doing wrong here that installing the framework does not work?
Ld
/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/mylib/mylib.framework/mylib
normal (in target 'mylib' from project 'Pods')
cd /Users/user/appdemo/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-target x86_64-apple-ios10.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk
-L/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/mylib
-F/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/mylib
-F/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/GoogleUtilities
-F/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/PrebidMobile
-F/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/PromisesObjC
-F/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/mopub-ios-sdk
-F/Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/nanopb
-F/Users/user/appdemo/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current
-F/Users/user/appdemo/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_armv7
-F/Users/user/appdemo/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_i386_x86_64-simulator
-F/Users/user/appdemo/Pods/GoogleAds-IMA-iOS-SDK -F/Users/user/appdemo/Pods/GoogleAppMeasurement/Frameworks -F/Users/user/appdemo/Pods/GoogleUserMessagingPlatform/Frameworks/Release
-F/Users/user/appdemo/Pods/GoogleUserMessagingPlatform/Frameworks/Release/UserMessagingPlatform.xcframework/ios-arm64_armv7
-F/Users/user/appdemo/Pods/GoogleUserMessagingPlatform/Frameworks/Release/UserMessagingPlatform.xcframework/ios-arm64_i386_x86_64-simulator
-filelist /Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/mylib.build/Objects-normal/x86_64/mylib.LinkFileList
-install_name @rpath/mylib.framework/mylib -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks
-Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/mylib.build/Objects-normal/x86_64/mylib_lto.o
-Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
-L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/mylib.build/Objects-normal/x86_64/mylib.swiftmodule
-framework AVFoundation -framework AdSupport -framework AudioToolbox -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreMedia -framework CoreTelephony -framework CoreVideo -framework Foundation -framework GoogleInteractiveMediaAds -framework MediaPlayer -framework MessageUI -framework MobileCoreServices
-framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -framework UIKit -framework WebKit -weak_framework AdSupport -weak_framework JavaScriptCore -weak_framework SafariServices -weak_framework StoreKit -weak_framework WebKit -framework CoreTelephony -framework Foundation -framework MoPub -framework PrebidMobile -framework SystemConfiguration -framework UIKit -Xlinker -no_adhoc_codesign
-compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/mylib.build/Objects-normal/x86_64/mylib_dependency_info.dat
-o /Users/user/Library/Developer/Xcode/DerivedData/appdemo-gmoqpiaozrywmeguhfldbwybeebb/Build/Products/Debug-iphonesimulator/mylib/mylib.framework/mylib
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_DFPRequest", referenced from:
objc-class-ref in Banner.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation)
question from:
https://stackoverflow.com/questions/65904002/undefined-symbol-objc-class-when-creating-ios-framework