Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use_frameworks! for only some pods or swift pods

Tags:

I have both Objective C and Swift Pods in my project.

pod 'WBWebViewConsole', '~> 1.0.1'  use_frameworks!  pod 'XWebView', '~>0.9.5’  pod 'Starscream', '~> 1.1.3' 

As swift PODs(XWebView, Starscream) can only be added as frameworks I have to use use_frameworks!

But this makes all the PODs as framework including Objective-C PODs(WBWebViewConsole) as well.

But it causes problem with Objective-C POD but I don't intend to make Objective-C POD as framework.

So is there anyway I can ignore couple of PODs from being converted as framework ?

Thanks.

Update:

How to reproduce the problem ?

The problem is with the POD WBWebViewConsole

Run the attached project in any iOS 8+ devices that has internet connection as it loads a html doc from google drive.

in the html doc … click General/Info/Warning/Debug/Error Log

enter image description here

you will some text appearing on the html page whenever u click any of the above buttons….

The library is about capturing the logs that’s generated in html page…

Whenever u click the button apart from showing some text in html page I am writing some log in background.

enter image description here

Now click on the button get logs … and see the logs in Xcode IDE… you will see the all the console logs that’s generated in html

enter image description here

Get logs-> is a native button super imposed on webview..the library lets us read the console logs from wkwebview ..

Now in the POD u uncomment the following lines

use_frameworks! pod 'PLCrashReporter' pod 'XWebView', '~> 0.9.5’ 

and do pod install

then paste the following code on top of ViewController

import WBWebViewConsole 

Here is the project with which has all this uncommented with all the changes required to reproduce the problem

now u run the project on device and click some buttons in html page and click get logs you can't see comments that's generated in the html page

To be specific below delegate methods implemented in WBWKWebView are not getting fired.

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler - (void)wb_evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^)(NSString *, NSError *))completionHandler 

But while creating the instance of WBWKWebView and loading a URL all the necessary delegates of this class are getting fired.

The above delegates are supposed to fire when a log is written while clicking the button in html page

like image 426
Durai Amuthan.H Avatar asked May 23 '16 10:05

Durai Amuthan.H


People also ask

What is Use_frameworks in POD file?

use_frameworks! in the Podfile means that we want the listed frameworks to be dynamically installed instead as static frameworks.

What is Use_modular_headers?

The use_modular_headers option generates module maps for Swift and Objective-C pods instead of generating frameworks. See http://blog.cocoapods.org/CocoaPods-1.5.0/ Attached is an example project (AppCode 2018.1, Xcode 9.3, Swift 4.1)


1 Answers

You can overwrite use_frameworks! and install all pods as static except for the ones you choose to be a framework

In the Podfile use use_frameworks! And at the end of the file add

dynamic_frameworks = ['aaa','bbb'] # <- swift libraries names  # Make all the other frameworks into static frameworks by overriding the static_framework? function to return true pre_install do |installer|   installer.pod_targets.each do |pod|     if !dynamic_frameworks.include?(pod.name)       puts "Overriding the static_framework? method for #{pod.name}"       def pod.static_framework?;         true       end       def pod.build_type;         Pod::BuildType.static_library       end     end   end end 
like image 125
MujtabaFR Avatar answered Jan 02 '23 22:01

MujtabaFR