How to use RxSwift for Objective-C and Swift project? - ios

A project was created in Objective-C language and later I used Swift in it. In my pod-file I have couple of Objective-C pods. I tried using RxSwift pod, it didn't allow me to have Swift pods and moreover I can't use use_frameworks! because I have Objective-C pods in it.
platform :ios, '8.0'
# use_frameworks!
target 'MyProject' do
pod 'STPopup'
pod 'AFNetworking', '~> 3.1.0'
pod 'Reachability'
pod 'SVProgressHUD'
pod 'CCHMapClusterController'
pod 'SDWebImage', '~> 3.8.2'
pod 'DateTools'
pod 'Fabric'
pod 'TwitterKit'
pod 'Crashlytics'
pod 'SpinKit', '~> 1.1'
pod 'GPUImage'
pod 'LLSimpleCamera', '~> 5.0'
pod 'MGSwipeTableCell'
pod 'JSONModel'
pod 'ASIHTTPRequest'
pod 'PEPhotoCropEditor', :git => 'https://github.com/luyzdeleon/PEPhotoCropEditor'
pod 'RSKImageCropper', :git => 'https://github.com/luyzdeleon/RSKImageCropper'
pod 'MXParallaxHeader'
pod 'Toast', '~> 3.0'
pod 'TransformerKit'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FRHyperLabel', '~> 1.0.1'
pod 'STTweetLabel', :git => 'https://github.com/pabelnl/STTweetLabel.git', :branch => 'master'
pod 'STTwitter'
pod 'YSTutorialViewController'
pod 'CTAssetsPickerController', :git => 'https://github.com/pabelnl/CTAssetsPickerController', :branch => 'master'
pod 'RDHCollectionViewGridLayout', '~> 1.2'
pod 'AFNetworking+RetryPolicy'
pod 'AWSMobileAnalytics', '~> 2.4'
pod 'CHTCollectionViewWaterfallLayout'
pod 'BBBadgeBarButtonItem'
pod 'FMDB'
pod 'APAddressBook'
pod 'CTVideoPlayerView'
pod 'IBProgressButton'
pod 'VIMVideoPlayer', :git => 'https://github.com/pabelnl/VIMVideoPlayer', :branch => 'master'
pod 'ICGVideoTrimmer'
pod 'CRGradientNavigationBar', :git => 'https://github.com/luyzdeleon/CRGradientNavigationBar', :branch => 'master'
pod 'KILabel', '~> 1.0.1'
pod 'Firebase/Auth'
pod 'GoogleSignIn'
pod 'SwiftTryCatch'
pod 'libPhoneNumber-iOS', '~> 0.8'
pod 'IGListKit'
pod 'SDWebImage-CircularProgressView'
pod 'RxSwift'
end
Error i am getting with out use_frameworks!:
[!] Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pod being used is: RxSwift
Error with use_frameworks!:
[!] Unable to integrate the following embedded targets with their respective host targets (a host target is a "parent" target which embeds a "child" target like a framework or extension):
MyProject (true) and share (false) do not both set use_frameworks!.

You can use use_frameworks! even if you have Objective-C pods in it.

Related

Library not found after installing Socket.IO-swift

I am using the Socket IO-Swift library in my current project. After installing the Socket.IO-Client-Swift pod file into my project, my FMDB library path is not found, showing this error:
library not found for -lAFNetworking
I'm using the following pods in my podfile:
pod 'Socket.IO-Client-Swift', '~> 12.1.0'
use_frameworks!
pod 'AFNetworking', '~> 3.1.0'
pod 'CocoaLumberjack', '~> 3.2.0'
pod 'MBProgressHUD', '~> 1.0.0'
pod 'SDWebImage', '~> 4.0.0'
pod 'Reachability', '~> 3.2’
pod 'IQKeyboardManager', '~> 4.0.9’
pod 'CrittercismSDK', '~> 5.6.8’
pod 'SocketIO’, '~> 0.0.1’
pod 'GPUImage’, '~> 0.1.7’
pod 'iCarousel’, '~> 1.8.3’
pod 'TwitterKit'
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'Google/SignIn'
pod 'Firebase/Core’
pod 'Firebase/Crash'
pod 'Fabric'
pod 'Crashlytics'
pod 'AWSCloudWatch'
pod 'AWSCognito'
pod 'AWSCognitoIdentityProvider'
pod 'AWSDynamoDB'
pod 'AWSEC2'
pod 'AWSIoT'
pod 'AWSKinesis'
pod 'AWSLambda'
pod 'AWSLex'
pod 'AWSMachineLearning'
pod 'AWSPinpoint'
pod 'AWSPolly'
pod 'AWSRekognition'
pod 'AWSS3'
pod 'AWSSES'
pod 'AWSSimpleDB'
pod 'AWSSNS'
pod 'AWSSQS'

Error with cocoapods link_with after update to 1.0.0

I have updated cocoapods today to 1.0.0 version. I got this string when I update the pods:
[!] Invalid Podfile file: [!] The specification of link_with in the Podfile is now unsupported, please use target blocks instead..
I have removed link_with in my podFile but I can't build the project because I have many Match-O-Linkers. Any one knows how should I fix this problem?
This is my Podfile right now:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
inhibit_all_warnings!
pod 'pop', '~> 1.0'
pod 'AFNetworking', '~> 1.3'
pod 'SDWebImage', '~> 3.7'
pod 'GoogleAnalytics', '~> 3'
pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"]
pod 'FBSDKCoreKit', '~> 4.10.1'
pod 'FBSDKLoginKit', '~> 4.10.1'
pod 'FBSDKShareKit', '~> 4.10.1'
pod 'Google/SignIn'
pod 'Branch'
pod 'Leanplum-iOS-SDK'
pod 'Fabric', '1.6.7'
pod 'Crashlytics', '3.7.0'
pod 'TwitterKit'
pod 'Digits'
target 'minubeTests' do
pod 'OCMockito'
end
Try this. Works for me with more than one target.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
def myPods
pod 'pop', '~> 1.0'
pod 'AFNetworking', '~> 1.3'
pod 'SDWebImage', '~> 3.7'
pod 'GoogleAnalytics', '~> 3'
pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"]
pod 'FBSDKCoreKit', '~> 4.10.1'
pod 'FBSDKLoginKit', '~> 4.10.1'
pod 'FBSDKShareKit', '~> 4.10.1'
pod 'Google/SignIn'
pod 'Branch'
pod 'Leanplum-iOS-SDK'
pod 'Fabric', '1.6.7'
pod 'Crashlytics', '3.7.0'
pod 'TwitterKit'
pod 'Digits'
end
target 'yourTargetOne' do
myPods
end
target 'yourTargetTwo' do
myPods
end
target 'minubeTests' do
pod 'OCMockito'
end
According to the new official CocoaPods specification since version 1.0 the new model is this:
Note that BasePods is not the actual name of any target in the project.
TargetNameOne and TargetNameTwo are the real names.
platform :ios, '8.1'
inhibit_all_warnings!
abstract_target 'BasePods' do
## Networking
pod 'AFNetworking', '~> 2.6'
# Twitter
pod 'TwitterKit', '~> 1.9'
pod 'Fabric'
# Specify your actual targets
target 'TargetNameOne'
target 'TargetNameTwo'
end
Edit - There is an implicit abstract target at the root of the Podfile now, so you could write the above example as:
platform :ios, '8.1'
inhibit_all_warnings!
## Networking
pod 'AFNetworking', '~> 2.6'
# Twitter
pod 'TwitterKit', '~> 1.9'
pod 'Fabric'
# Specify your actual targets
target 'TargetNameOne'
target 'TargetNameTwo'
This is for multiple targets which is the most common case, but can be used for single target as well and I like one universal pattern.
With the new specification. all your pod include should be specified target based.
Change your pod file to
platform :ios, '8.0'
# change minube to whatever name is of you main target
target 'minube' do
pod 'pop', '~> 1.0'
pod 'AFNetworking', '~> 1.3'
pod 'SDWebImage', '~> 3.7'
pod 'GoogleAnalytics', '~> 3'
pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"]
pod 'FBSDKCoreKit', '~> 4.10.1'
pod 'FBSDKLoginKit', '~> 4.10.1'
pod 'FBSDKShareKit', '~> 4.10.1'
pod 'Google/SignIn'
pod 'Branch'
pod 'Leanplum-iOS-SDK'
pod 'Fabric', '1.6.7'
pod 'Crashlytics', '3.7.0'
pod 'TwitterKit'
pod 'Digits'
end
target 'minubeTests' do
pod 'OCMockito'
end

CocoaPods Pod install weird behavior

I am currently trying to install these Pods in my Xcode project but am getting the following screen when I try pod install. I have been getting this message in xCode when trying to run my project so I thought I would just try and re-install pods. But get the error below.
platform :ios, ‘8.0’
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire', '~> 3.0'
pod 'GooglePlacesAutocomplete'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git', :branch => 'swift2'
pod 'DropDown'
pod 'AlamofireImage', '~> 2.0'
When I run pod install I get the following message on screen in the terminal.
If you are using Cocoapods v0.39 you need to define a target for your pods
target :'nameOfTheScheme' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire', '~> 3.0'
pod 'GooglePlacesAutocomplete'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git', :branch => 'swift2'
pod 'DropDown'
pod 'AlamofireImage', '~> 2.0'
end

Frameworks on Cocoapods using old iOS version

When I run pod install Cocoapods Frameworks are referring to iOS 8.3 I can't find the way to change them to iOS 9
--Screenshots
http://1drv.ms/1iTSswC
I'm currently using Xcode 7. My Podfile:
platform :ios, '9.0'
#source 'https://github.com/CocoaPods/Specs.git'
# ignore all warnings from all pods
inhibit_all_warnings!
xcodeproj 'Conversa'
link_with 'Conversa', 'ConversaTests'
pod 'AFNetworking', '~> 2.5'
pod 'JSQMessagesViewController', '~> 7.2.0'
pod 'JSQSystemSoundPlayer', '~> 2.0'
pod 'CocoaLumberjack'
pod 'Fabric'
pod 'Crashlytics'
#pod 'UIActionSheet+Blocks'
pod 'UIAlertView-Blocks'
pod 'YapDatabase/SQLCipher'
pod 'JVFloatLabeledTextField'
pod 'CRToast', '~> 0.0.7'
#pod 'Mantle', '~> 1.4'
#pod 'Navajo', '~> 0.0'
pod 'Appirater'
pod 'SIAlertView'
pod 'GCDWebServer', '~> 3.0'

Cocoapods library not found for apple watch extensions

Here is my PodFiles, as apple watch extension only need part of the library in the main app.
# Uncomment this line to define a global platform for your project
platform :ios, '7.0'
######################
source 'https://github.com/CocoaPods/Specs.git'
#source 'https://github.com/albertodebortoli/ADBCocoaPodsRepository.git'
target 'MyAppDev WatchKit Extension', :exclusive => true do
pod 'MagicalRecord/Core+Logging', :git => 'https://github.com/magicalpanda/MagicalRecord.git'
pod 'BlocksKit'
pod 'EncryptedCoreData'
end
# Logging
pod 'CocoaLumberjack' #2.0.0-beta4 at the moment
# Networking
pod 'AFNetworking', '~> 2.0'
#pod 'IADownloadManager'
#pod 'TCBlobDownload'
#pod 'ObjectiveCDM', '~> 1.0.5'
#pod 'librabbitmq-objc'
# Database
pod 'MagicalRecord/Core+Logging', :git => 'https://github.com/magicalpanda/MagicalRecord.git'
#pod 'couchbase-lite-ios'
######################
pod 'StompKit'
######################
#pod 'MQTTKit', :git => 'https://github.com/iosphere/MQTTKit'
# Utilities
pod 'XMLDictionary'
pod 'THObserversAndBinders'
pod 'CocoaSecurity'
pod 'KVOController'
pod 'INTULocationManager'
pod 'zipzap'
pod 'libextobjc'
pod 'ReactiveCocoa'
pod 'EncryptedCoreData'
pod 'LPGoogleFunctions'
# UI
pod 'BFPaperButton', '~> 1.5.7'
pod 'SWTableViewCell', '~> 0.3.6'
pod 'FXImageView', '~> 1.3.5'
pod 'MZFormSheetController' , '~> 2.4.1'
pod 'SVProgressHUD'
#pod 'UITableView-AnimationControl'
#pod 'SlackTextViewController'
pod 'QBImagePickerController'
pod 'MWPhotoBrowser'
pod 'SDWebImage', '~>3.6'
pod 'BlocksKit'
pod 'SIAlertView'
pod 'SZTextView'
pod 'ACEDrawingView'
pod 'PEPhotoCropEditor'
pod 'RBStoryboardLink'
pod 'AMPPreviewController'
when I build the target, I got the following error
library not found for -lPods-EncryptedCoreData
but I did include EncryptedCoreData Library in both targets.
any idea?

Resources