How can I replace link_with with abstract_target? - ios

I updated the gem pod and I am now getting an error while compiline Signal-iOS. Here is the error I am getting:
[!] Invalid Podfile file: [!] The specification of link_with in
the Podfile is now unsupported, please use target blocks instead..
Here is the content of the Podfile:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
link_with ["Signal", "SignalTests"]
I have absolutely no familiarity with CocosPod so this is gibberish to me. I spent time reading online docs, but there is a bit of conflicting information due to the recent changes and deprecation of commands. What is the recommended way to change the file so the project can build again?

In this case, it would be like this:
platform :ios, '8.0'
target 'Signal' do
pod 'SignalServiceKit', :git => 'https://github.com/WhisperSystems/SignalServiceKit.git'
pod 'OpenSSL', '~> 1.0.208'
pod 'PastelogKit', '~> 1.3'
pod 'FFCircularProgressView', '~> 0.5'
pod 'SCWaveformView', '~> 1.0'
pod 'DJWActionSheet'
pod 'JSQMessagesViewController', :git => 'https://github.com/WhisperSystems/JSQMessagesViewController', :commit => 'e5582fef8a6b3e35f8070361ef37237222da712b'
target 'SignalTests' do
inherit! :search_paths
end
end
I've recommended it on this PR: https://github.com/WhisperSystems/Signal-iOS/pull/1180

Related

Using a Notification Extension causes issue with Cocoapods

I have a Notification Extension in my app. However, when I build my app it conflicts with the pod FBSDKLoginKit. It gives me the following error in the FBSDKCoreKit:
'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
My Podfile looks like this (I've missed out irrelevant pods):
workspace 'MyApp'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
project 'MyApp.xcodeproj'
pod 'FBSDKLoginKit'
pod 'OneSignal', '>= 2.6.2', '< 3.0'
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
end
How do I fix this?
Move your OneSignalNotificationServiceExtension target out of your main target in your Podfile. Don't forget to also define use_frameworks! in it!
workspace 'MyApp'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
project 'MyApp.xcodeproj'
pod 'FBSDKLoginKit'
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
pod install, Clean and Build and that should do the trick 👍

Too many errors after updating to Cocoapods 1.0

Good afternoon,
After updating to the latest version of Cocoapods (1.0) my iOS application shows a lot of errors. I'm not sure why is this happening because during the update everything was correct, but when I "Run" my app, it shows the following errors:
And that's my Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'myApp' do
pod 'HanekeSwift', '~> 0.10'
pod 'Alamofire', '~> 3.3'
pod 'SwiftyJSON', '~> 2.3'
pod 'Batch', '~> 1.5'
end
target 'myAppTests' do
end
target 'myAppUITests' do
end
What can I do in order to solve those problems?
Much appreciated,
Regards.
If you ran pod install and its still not working.
Try pod deintegrate and then pod install. It should fix the issue.
If someone has the same problem, I have deleted the old Podfile and create a new one. And now that's how it looks like:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'myApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for myApp
pod 'Alamofire', '~> 3.4'
pod 'SwiftyJSON', '~> 2.3'
pod 'HanekeSwift', '~> 0.10'
pod 'Batch', '~> 1.5'
target 'myAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'myAppUITests' do
inherit! :search_paths
# Pods for testing
end
end

WatchKit Can't Import Library From Pods

I'm adding a watch application, and I'm attempting to import a library within my WatchKit Extension that my iOS app uses (SwiftyJSON). I have updated my podfile as such:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'Alamofire', '~> 3.0'
pod 'AlamofireImage', '~> 2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod "PubNub", "~> 4.1"
pod 'Siren'
end
target 'MyAppWatch Extension' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end
When I run the pod install, everything seems to behave like it should. The problem is when I'm using the import SwiftyJSON inside an WKInterfaceController, I get the error No such module SwiftyJSON. Is there another setting that I haven't set properly?
The way I use to add pods to the watchOS framework with the following podfile:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
link_with 'AppName'
target 'WatchName Extension' do
platform :watchos, '2.0'
pod 'NameOfYourPOd', '~> x.0.0'
end
But there is a very important point about the include of some libraries in the Watch Extension, there are libraries that do not support watchos as a platform yet. There are some good articles about how to add it manually to its podspec to support it.
I hope this help you

Cocoapods Test Issue - Duplicate "one of the two will be used. which one is undefined."

I've been trying to solve this issue for a couple days and haven't found a solution. Whenever I try to run a test I receive the error shown below that there are duplicate classes.
I tried these answers but I'm still receiving the duplicate error and my tests won't run
Cocoapods Warning - CocoaPods did not set the base configuration of your project because because your project already has a custom config set
My pod file looks like this:
platform :ios, "8.0"
def project_pods
pod "Braintree"
pod "AFNetworking", "~> 3.0"
pod "MBProgressHUD"
pod "ActionSheetPicker-3.0", "~> 2.0.1"
pod "SCLAlertView-Objective-C", "~> 0.7"
pod "GoogleMaps"
pod "MPSHorizontalMenu"
pod "Fabric"
pod "Crashlytics"
pod "RateView"
pod "QBImagePickerController"
pod "GLCalendarView", "~> 1.0.0"
pod "Heap"
pod "AWSS3"
end
target “iOS_project” do
project_pods
end
target “iOS_projectTests” do
project_pods
end
This is what the error looks like and it is for every cocoapod class:
Class GMSAutocompleteResultsViewController is implemented in both /Users/john/Library/Developer/CoreSimulator/Devices/27CF0470-07AC-4575-8907-A27EE9B357A7/data/Containers/Bundle/Application/7AFB0886-9ED1-464D-8B02-067CDD07511D/iOS_project.app/iOS_project and /Users/john/Library/Developer/Xcode/DerivedData/iOS_projectTests-hezbkjqviaiitthcrrnwetvcojcb/Build/Products/Debug-iphonesimulator/iOS_projectTests.xctest/iOS_projectTests. One of the two will be used. Which one is undefined.
All of the pods are Objective C and I am using a bridging header
Reformat your podfile like this:
platform :ios, "8.0"
def project_pods
pod "Braintree"
pod "AFNetworking", "~> 3.0"
pod "MBProgressHUD"
pod "ActionSheetPicker-3.0", "~> 2.0.1"
pod "SCLAlertView-Objective-C", "~> 0.7"
pod "GoogleMaps"
pod "MPSHorizontalMenu"
pod "Fabric"
pod "Crashlytics"
pod "RateView"
pod "QBImagePickerController"
pod "GLCalendarView", "~> 1.0.0"
pod "Heap"
pod "AWSS3"
target "iOS_projectTests" do
inherit! :search_paths
end
end
target "iOS_project" do
project_pods
end
Source: CocoaPods issue #4626
The error indicates that '
GMSAutocompleteResultsViewController' is integrated two time and only one is used from it
If you are not using unit testing case target for now you can remove that portion from the podfile and check again by pod install or pod update
Remove this portion from your podfile
target “iOS_projectTests” do
project_pods
end
For swift it will be good if you set use_frameworks! below the platform version
so your top portion can be like
platform :ios, "8.0"
use_frameworks!
so your new podfile can look like this
platform :ios, "8.0"
use_frameworks!
def project_pods
pod "Braintree"
pod "AFNetworking", "~> 3.0"
pod "MBProgressHUD"
pod "ActionSheetPicker-3.0", "~> 2.0.1"
pod "SCLAlertView-Objective-C", "~> 0.7"
pod "GoogleMaps"
pod "MPSHorizontalMenu"
pod "Fabric"
pod "Crashlytics"
pod "RateView"
pod "QBImagePickerController"
pod "GLCalendarView", "~> 1.0.0"
pod "Heap"
pod "AWSS3"
end
target “iOS_project” do
project_pods
end
target “iOS_projectTests” do
project_pods
end
Hope this helps, if it still shows the error you may put pods directly on the target instead of putting in def at top
Note: For the Google map you can also directly import the framework like import GoogleMaps instead of adding google maps in the bridging header
now, modify Podfile by commenting use_frameworks! ,like below:
platform :ios, '8.0'
#use_frameworks!
target 'ShiBa' do
pod 'SDWebImage'
pod 'AFNetworking'
pod 'MBProgressHUD'
pod 'MJRefresh', '3.1.0'
pod 'UMengAnalytics'
pod 'YYModel'
pod 'AMapLocation'
pod 'pop'
end

Link pod in Podfile to a specific target

Here is my podfile, is it possible to link the FXForms pod only to the "MainTarget" target?
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod "AFNetworking"
pod 'CryptoCoding', "~> 1.1"
pod 'FXForms'
pod "FDKeychain", "~> 1.0.0"
pod 'SVProgressHUD'
link_with 'MainTarget', 'ExtensionTarget'
Nothing easier than that:
target :MainTarget do
pod 'FXForms'
end
For more infos see CocoaPods documentation

Resources