问题
I'm using Firebase in My App, I used it via pod and everything was work correctly,
Then we Add Today Extensions (2 extensions) to our app, and also we need to use Firebase in it, so I added it to podfile like this:
use_frameworks!
project ‘projectName.xcodeproj'
target ‘appName’ do
pod 'Firebase/Core'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end
target ‘todayExtension1_Name’ do
pod 'Firebase/Core'
end
target ‘todayExtension2_Name’ do
pod 'Firebase/Core'
end
and I create two apps for the todayExtensions, and implement the .plist files correctly and the app build successfully.
but when I try to run the app, I got this runtime exception:
dyld: Symbol not found: _OBJC_CLASS_$_GTMLogLevelFilter Referenced from: /Users/rawanal-omari/Library/Developer/CoreSimulator/Devices/33A7DC45-EFD9-4245-8989-7C6B4194481F/data/Containers/Bundle/Application/84C060C2-A4AE-4AF3-8804-ADA8CFBCABB3/appName.app/appName Expected in: /Users/rawanal-omari/Library/Developer/CoreSimulator/Devices/33A7DC45-EFD9-4245-8989-7C6B4194481F/data/Containers/Bundle/Application/84C060C2-A4AE-4AF3-8804-ADA8CFBCABB3/appName.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac in /Users/rawanal-omari/Library/Developer/CoreSimulator/Devices/33A7DC45-EFD9-4245-8989-7C6B4194481F/data/Containers/Bundle/Application/84C060C2-A4AE-4AF3-8804-ADA8CFBCABB3/appName.app/appName
Did anyone face problem like this?
回答1:
Not sure if targeting the extensions via pods is enough, But the following steps are needed
Step 1. Go to your firebase console.
Step 2. Click on the project you are working on.
Step 3. Within the project, click on "Add another app"
Step 4. Select iOS and then enter the BUNDLE ID of your TODAY EXTENSION
Step 5. Complete the wizard and download the generated GoogleService-Info.plist file. Add the plist file to your Today Extension's root folder
From here you can try adding firebase via pods to your extensions.
回答2:
I had the same problem. In my case I've added the 'Firebase/Performance' pod to the app target, but not to the extension target. After adding it to the extension too, I was able to run the app again.
Conclusion: add the Firebase pods you're using in your app target, to the extension target too
来源:https://stackoverflow.com/questions/46826315/using-firebase-in-the-app-and-today-extension-doesnt-work