Hello I'm working on an old Objective-C project, that has 30+ pods dependecies, all written in Objective-C.
I'm trying to add a Swift pod, this one in particular :
pod 'CSV.swift', '~> 2.4.3'
# ...
# other Objective-C pods ...
# ...
Because I would like to continue new developments in Swift.
But I cannot make it work. If I add use_frameworks!, I get an error at pod install :
The 'Pods-myProject' target has transitive dependencies that include static binaries: (/myProjectPath/Pods/ObjcPod/ObjcPod.framework)
And if I remove use_frameworks!, I get tons of compilation errors, here are some :
Undefined symbol: protocol descriptor for Swift.UnicodeCodec
Undefined symbol: dispatch thunk of Swift.UnicodeCodec.decode<A where A1: Swift.IteratorProtocol, A.CodeUnit == A1.Element>(inout A1) -> Swift.UnicodeDecodingResult
I don't know what I could try otherwise, any help would be much appreciated !
This way you can use swift pod in objective c project try this solution.
Write in your pod file
target 'YourProjectName' do
use_frameworks!
pod 'CSV.swift', '~> 2.4.3'
// Here you can add mode pod as per your requirement Like
pod 'Firebase/Core'
pod 'Fabric'
pod 'Crashlytics'
end
Then Run Pod Install.
For import write this
#import CSV;
And then you have access of your CSV pod files.
Related
Is there any possibility to use MapboxNavigation (version 0.21 or 0.22) iOS with Xcode 10. On its Github and CocoaPods site is stated, that it can only be used with Xcode 9, but a few issues on Github mention the (successful) use of Xcode 10 with MapboxNavigation.
However, I tried to install MapboxNavigation via CocoaPods using Xcode 10 and get a bunch of errors:
/Users/Paul_Obernolte/Library/Developer/Xcode/DerivedData/pq-app-v2-gynuaxsohvqddqegrvemywowchkr/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/Swift Compatibility Header/MapboxDirections-Swift.h:171:9: error: 'MapboxDirections/MapboxDirections.h' file not found
#import <MapboxDirections/MapboxDirections.h>
^
<unknown>:0: error: could not build Objective-C module 'MapboxDirections'
Is there any workaround to avoid this errors using Xcode 10?
Edit: Here is my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
EXPO_CPP_HEADER_DIR = 'ExpoKit'
target 'pq-app-v2' do
pod 'MapboxDirections.swift', '~> 0.23'
pod 'MapboxMobileEvents',
:git => 'https://github.com/mapbox/mapbox-events-ios.git',
:commit => "79d29f1df5a9187481f5c9ac8fa13430d1f04139"
pod 'MapboxNavigation', '~> 0.21.0'
... (more Pods)
end
I need to download MapboxMobileEvents separately because of this issue: https://github.com/mapbox/mapbox-events-ios/pull/85
target 'pq-app-v2' do
use_frameworks!
... (more Pods)
end
change code in pod file if "use_frameworks!" is commented than put it uncommented as above.
I am trying to get a app running which was written by some guys some years ago. Instead of a Podfile, the app had a file called SBPodfile with the following content:
#platform :ios, "8.0"
#use_frameworks!
target '------' do
pod 'ZCSFileExtensionForMimeType', :git => 'https://github.com/----/ZCSFileExtensionForMimeType.git'
pod 'AMSlideMenu', '~> 1.5.4'
pod 'SSKeychain'
pod 'SVProgressHUD', '~> 1.1'
SB_PODS_START
ObjCSBLog
ObjCSBDeviceHelper
ObjCSBSynthesizeSingleton
ObjCSBFileHandler
ObjCSBImageCreationHelper
ObjCSBAlertViewHelper
SB_PODS_END
end
target 'actionExtension' do
pod 'ZCSFileExtensionForMimeType', :git => 'https://github.com/-----/ZCSFileExtensionForMimeType.git'
pod 'SSKeychain'
pod 'UAProgressView', '~> 0.1'
SB_PODS_START
ObjCSBLog
ObjCSBDeviceHelper
ObjCSBSynthesizeSingleton
ObjCSBFileHandler
SB_PODS_END
end
target '-----' do
end
The app wouldn't compile because there was no Podfile. So I renamed the SBPodfile to Podfile. Now I am getting the error that the constant "SB_PODS_START" is not defined. I couldn't find out anything about that weird "SB block" on google. Does anyone have a clue what it is.
I have to add that I am relatively new to iOS development, especially in objective c.
Edit: I think that SB stands for the Company which developed the App and they are loading some custom libraries. But I still don't know how it works.
I have a problem uploading my application into the Store via Xcode, this one in particular.
I saw a lot of post about this error, but all are talking about Extension App, that I do not use.
I'm using a Custom framework and Cocoapods.
You can see here my tree :
XXX is my project app name
SharedXXX is my custom framework
Pods is the project created by cocoa pods
Here is my cocoa podFile :
use_frameworks!
link_with 'XXX', 'SharedXXX'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
workspace 'XXX'
xcodeproj 'XXX/XXX.xcodeproj'
xcodeproj 'Shared/SharedXXX.xcodeproj'
def default_pods
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod "SnapKit", '~> 0.17.0'
pod "DKChainableAnimationKit", '~> 1.6.0'
pod "AsyncSwift"
end
def shared_pods
pod "Alamofire", '~> 3.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift', :git => 'https://github.com/ashleymills/Reachability.swift'
end
target :XXX do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :XXXDev do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :SharedXXX do
xcodeproj 'Shared/SharedXXXX.xcodeproj'
shared_pods
end
Build settings for custom framework (SharedXXX) :
I set the Embedded property to Yes
General Settings for custom framework (SharedXXX) :
The framework provided by Cocoapods is linked.
And to finish,
The General Settings to the main project (App Project : called XXX on the tree)
:
Any idea ?
I solved the problem
Firstly, set into Build Settings
For main project (here XXX) : Embedded Content Contains Swift Code to
YES
Custom Framework (SharedXXX) : Embedded Content Contains Swift Code to NO
Custom Framework (SharedXXX) : Runpath Search Path = #executable_path/../../Frameworks
This helped me solving that issue
I faced the same problem while trying to upload from Xcode 9.3
This happened because I added 'use_frameworks' in my OneSignal
NotificationServiceExtension
The value Always Embed Swift Standard Libraries found in Build Settings should be set to Yes only for you main Projects and not for your custom frameworks or extensions.
I just pod installed this Podfile for a new project:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
def import_pods
pod 'Mantle'
pod 'LBBlurredImage'
pod 'TSMessages'
pod 'ReactiveCocoa'
end
target 'WeatherJoy2' do
import_pods
link_with 'WeatherJoy2'
end
pod install succeeeded but now getting the following errors on building the project:
/Users/ankit/Documents/WeatherJoy2/Pods/ReactiveCocoa/ReactiveCocoa/NSObject+RACKVOWrapper.m:49:3: Unknown type name 'rac_propertyAttributes'; did you mean 'mtl_propertyAttributes'?
/Users/ankit/Documents/WeatherJoy2/Pods/ReactiveCocoa/ReactiveCocoa/NSObject+RACKVOWrapper.m:49:40: Implicit declaration of function 'rac_copyPropertyAttributes' is invalid in C99
/Users/ankit/Documents/WeatherJoy2/Pods/ReactiveCocoa/ReactiveCocoa/NSObject+RACKVOWrapper.m:49:27: Incompatible integer to pointer conversion initializing 'mtl_propertyAttributes *' with an expression of type 'int'
There is nothing else in the project, it was a new project. I'm on xcode 6.2 and OSX 10.9.5
I had the same issue when using Mantle and ReactiveCocoa together. It appears to be caused by both pods having an EXTRuntimeExtensions.h header, which made ReactiveCocoa import the incompatible Mantle version of the header (with mtl_ vs rac_ function name prefixes).
In my case I fixed it by replacing each occurrence of #import "EXTRuntimeExtensions.h" in the ReactiveCocoa pod with #import "../Objective-C/extobjc/EXTRuntimeExtensions.h"
As an option you can set ReactiveCocoa version less then 3.0.0. For example, version 2.5 is normally working with Mantle.
pod 'Mantle', "~> 2.0.2"
pod 'ReactiveCocoa', "~> 2.5"
As suggest title, I need to use InstagramKit (3.5.0) pod (written in objective-c) in a new swift project.
So I install pod (pod install), then I create my InstagramSwift-Bridging-Header.h and add-import library:
#import <InstagramKit/InstagramEngine.h>
Then, just building this empty project, I get:
/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5:9:
note: in file included from
/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5:
-(BOOL)application:(UIApplication *)application
^ <unknown>:0:
error: failed to import bridging header
'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h'
Expected a type Failed to import bridging header
'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h'
What could I miss?
After a lot of discussions with #eric-d, I probably find the problem in my podfile that was:
target "InstagramSwift" do
pod 'InstagramKit', '3.5.0'
end
So I deleted project and start again from an empty project using Podfile:
use_frameworks!
platform :ios, '8.0'
pod 'AFNetworking', '~> 2.5'
pod 'InstagramKit', '3.5.0'
Than I manually created SwitBridge.h and linked it in build settings.
Finally, in any swift file I can use instagramKit module, for example:
import InstagramKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let instagramEngine: InstagramEngine = InstagramEngine.sharedEngine()
}
}
Probably, problem was that platform setting is missing.
edit
Also,
"use_frameworks!"
thanks to this answer.