How do we log requests with AFNetworking 3.0 - afnetworking

How do we log requests with AFNetworking 3.x? It looks like AFNetworkActivityLogger is for AFNetworking 2.x

Add this line in your podfile and run pod install :
pod 'AFNetworkActivityLogger', git: 'https://github.com/AFNetworking/AFNetworkActivityLogger.git', branch: '3_0_0'
Read more about this because some of the methods in 2.x has been moved to other places.
https://github.com/AFNetworking/AFNetworkActivityLogger/tree/3_0_0#2x---3x-migration

Related

Lexical or Preprocessor issue: 'realm/keys.hpp' file not found

I recently switched to Xcode 11.4 and using Swift 5. I run pod install, Realm and RealmSwift installed with the latest version till date. Now when I run the project, its showing me an error:
..../Pods/Realm/include/binding_context.hpp:24:10: 'realm/keys.hpp' file not found
Podfile:
pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
Realm framework version: 4.4.1
Cocoapod version: 1.9.1
Xcode version: 11.4
Why is the error occurring and how can we get rid of the same?
To resolve the issue, I had to:
remove pod 'RealmSwift' from my podfile
run pod install
re-add pod 'RealmSwift' in my podfile
run pod install again to get latest version. It resolved the issue.
I got rid of the error by updating my pods. I ran pod update in the terminal after navigating to the project folder.

Alamofire not working after upgrading (Swift/Xcode 8)

My earlier version of swift was in 2.2.
I have updated Alamofire using different options like
pod 'Alamofire', '~> 4.0'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'
Whenever I open the workspace, it asks to convert to latest, I opted for swift 2.3. But the Xcode shows the errors below:
Header 'Alamofire-Swift.h' not found
Could not build Objective-C module 'Alamofire'
and inside Alamofire
Cannot convert value of type 'SecTrustResultType' to expected argument type 'UInt32'
I have deleted the files under the folders ~/Library/Developer/Xcode/DerivedData and build again . Same errors display.
What may be the wrong thing I did ?
As per Alamofire documentation it will work only with :
CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+.
I followed following steps and it's working fine :
Open your terminal -
sudo gem update --system
sudo gem install -n /usr/local/bin cocoapods --pre (It will install prerelease version 1.1.0.rc.3 because final version not came yet)
pod setup
pod repo update
remove all pods of your project and install it again ( Comment pod names by # -> Do pod update and again by removing # -> Do pod update )

Can not compile when using the SwiftyJSON in iOS

I would like to add SwiftyJSON to my app.
I install it using the terminal and create a Podfile in the same folder.
I follow all the steps onSwiftyJSON on github. When I compile the xcode, it turns out the error:
It seems that I did not have a module called SwiftyJSON.modulemap.
What's wrong with that?
If you are working in swift 2.3 the pod is:
pod 'SwiftyJSON', '~> 2.4'
This is the pod that working properly.

the file tidy.h and buffio.h not found

I am developing app using CXFeedParser. But after doing all the integration,
The File "MWImageParser.m" is generating error.
# import "tidy.h" and "buffio.h" not found
buffio.h and tidy.h is a part of TidyLib.
Simple solution is to include its source in your project (see include and src folder).
Other solution is to include a cocoapod tidy-html5 (seems to be experimental, so be careful). There is a cocoapod for MWFeedParser too.
Check the Cocoapods website for more information (if you still need).
Basically, after installation (via sudo gem install cocoapods), you need to create the following Podfile in your project root, with the following content:
pod 'MWFeedParser', '~> 1.0'
pod 'tidy-html5', '~> 0.0'
Then run pod install and open the generated xcworkspace.
Note: only Podfile and Podfile.lock should be added to source control. The Pods directory can be ignored.
Edit: You are using CXFeedParser. If you look at the CXFeedParser podspec, you'll see it has a dependency with CTidy. So remove MWFeedParser from your project and have the following Podfile:
pod 'MWFeedParser', '~> 1.0'
pod 'CTidy', '~> 0.3'
There is very simply way i have found, no need to do any pod setup, just download the Tidy.h and Buffio.h from GIT Hub and include in Your project, and it will run smoothly..
Finally solved my own question.

Using pods with conflicting AFNetworking dependencies

I'm trying to use two pods--JGAFImageCache and ADNKit--that specify different versions of AFNetworking. Here's my Podfile:
platform :ios, '7.0'
pod 'AFNetworking'
pod 'ADNKit'
pod 'JGAFImageCache'
pod 'DerpKit'
pod 'SVProgressHUD'
pod 'SSKeychain'
pod 'iOS7Colors', '~> 2.0.0'
When running pod install, I get this message:
[!] ADNKit (1.3.1) tries to activate AFNetworking (~> 1.3.0)', but already activated version2.0.0-RC3' by Podfile, AFNetworking (2.0.0-RC3), AFNetworking/Core (2.0.0-RC3), AFNetworking/Core (2.0.0-RC3), AFNetworking/Core (2.0.0-RC3), and AFNetworking/Core (2.0.0-RC3).
Removing AFNetworking and relying on v1.3.0 in ADNKit results in this:
[!] JGAFImageCache (1.1.0) tries to activate AFNetworking (~> 1.2.0)', but already activated version1.3.3' by ADNKit (1.3.1).
I'd be happy working with v1.3.1; I don't need the latest version of AFNetworking.
How do I get JGAFImageCache and ADNKit to stop fighting over which version of AFNetworking to use?
Obviously, your best bet is to file an issue with those developers to use up to date dependencies. The problem is that those pods rely on AFNetworking's API to not change, so there could be issues if you try to use a later version and some of the API has been removed.
Another approach would be to fork those repos and then change the dependencies within the podfiles yourself so that they are both using the same dependency. Then you'd just point your app's podfile to install them from your forked repo. This could break something, so you'll have to check for yourself and it's obviously not a good long term solution.
pod 'ADNKit', :git => 'https://github.com/yourUsername/ADNKit.git'

Resources