How to solve an error - No such module 'Framework' for private framework that is used in main project and internal pod? - swift

We have internal framework (let’s call it Testable) as a target of Application Project. Testable is used in several targets of Application project and we don’t want to extract it to separate repo for a series of reasons. So our setup is following:
Workspace(App)
- Application Project
- Testable Framework
- Tests for Testable (uses Testable)
- Other Internal framework (uses Testable)
- Tests for Other internal Framework (use Testable)
- Application 1 (use Testable)
- Tests for Application 1 (use Testable)
- Application 2 (use Testable)
- Tests for Application 2 (use Testable)
… Other targets
- Pods Project
… pods targets
Next we introduced new internal framework(let’s call it Science) as a separate project in it’s own repo. Science project is stored close to App and uses Testable by :path => ‘relative path to project’..
Setup is following:
Workspace(Science)
- Science Project
- Science Framework (uses Testable)
- Tests for Science Framework
- Pods Project
Testable as -> pod 'Testable', :path => ‘../App/Testable'
Folders structure:
Project Folder
- App Folder
- Testable Folder
- Science Folder
Science.podspec:
Pod::Spec.new do |s|
s.name = ‘Science'
s.version = '0.1'
s.summary = 'Some Summary’
s.description = <<-DESC
Some description
DESC
s.homepage = 'https://github.com/‘
s.license = { :type => 'MIT', :text => <<-LICENSE
TEXT OF LICENSE
LICENSE
}
s.author = { ‘Author’ => 'aa#bb.cc’ }
s.source = { :git => 'https://github.com/..’, :tag => "v#{s.version}" }
s.source_files = '**/*.swift'
s.frameworks = 'Testable'
s.platform = :osx
s.osx.deployment_target = '11.0'
end
Steps
We connected Science Framework into App’s Workspace by:
pod ’Science’, :git => ‘url to git repo’, :tag => ‘some tag’
We did pod install and it finished successfully
We run build Application 1 from Workspace(App)
Expected
We expect that Application 1 is built successfully. So Testable dependency is correctly resolved for Science Pod and all the other targets in Workspace(App)
Actual
Swift Compiler Error: No such module 'Testable' that is displayed for each import Testable inside Science Pod *.swift files

Related

Unable to Determine Swift Version for the Following Pods Error

I am trying to use Algolia for iOS. SWIFT_VERSION is not found for the Pod and throwing an error
Disclaimer, Algolia put out a podsec that does include the SWIFT_VERSION so I am able to proceed forward but wanted to know for the future if I run into the following error again
For the old pod, I followed the instructions here
https://cocoapods.org/pods/InstantSearchClient
I received this error
Unable to determine swift version for the following pods:
‘InstantSearchClient-library’ does not specify a Swift version and none of the
targets ( ‘Pods’ ) integrating it have the ‘SWIFT_VERSION’ attribute set. Please
contact the author or set the ‘SWIFT_VERSION’ attribute in at least one of the targets that inegrate this pod
StackOverflow had the following suggestions which did not work for me
use a pre_install
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Starscream')
set the ENV['SWIFT_VERSION'] = '5' at the top of the Podfile
'Unable to determine Swift version for the following pod" - Error
Set the SWIFT_VERSION in code ( I received an error message that the variable SWIFT_VERSION ) was already in use
Here is my code:
ENV['SWIFT_VERSION'] = '5'
platform :ios, '9.0'
pod 'InstantSearchClient', '~> 7.0'
target 'contacts' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
project 'contacts'
# Pods for contacts
target 'contactsTests' do
inherit! :search_paths
# Pods for testing
end
target 'contactsUITests' do
# Pods for testing
end
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
if s.name == 'InstantSearchClient'
s.swift_version = '5.0'
end
end
end
end

cocoapods error : ~ target has frameworks with conflicting names: ~

My problem is pretty simple and stackoverflow has many 'similar' problems but couldn't find the exact one. Maybe too easy to solve? Anyway, here is the problem:
I use X in podfile like this:
pod 'X', '3.3.4'
and when I added the follwing,
pod 'MapboxNavigation', '~> 0.17'
I got this error from pod:
[!] The ‘Pods-WayStride’ target has frameworks with conflicting names: mapbox.framework.
And yes, the X that I've been using uses 'mapbox.framework', probably part of it, already, as I can see it under 'Pods > Pods > Steerpath-Map-SDK > Frameworks > Mapbox.framework' in Project navigator of Xcode.
Because of this error, when I tried to compile using Xcode (ver 9.4, with swift), I get this error on the line of 'import MapboxDirections':
No such module 'MapboxDirections'
What can I do?
My Podfile is very simple:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.3'
# by SP
source 'https://github.com/CocoaPods/Specs.git'
source 'https://bitbucket.org/nimbledevices/steerpath-sdk-ios-podspec.git'
source 'https://bitbucket.org/nimbledevices/steerpath-mapbox-ios-podspec.git'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
target 'WayStride' do
# platform :ios, '8.0'
pod 'Steerpath', '3.3.4'
pod 'SwiftyJSON'
pod 'Mixpanel-swift'
pod 'Toast-Swift', '~> 3.0.1'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'MapboxNavigation', '~> 0.17'
# target 'WayStrideTests' do
# inherit! :search_paths
# # Pods for testing
# end
#
# target 'WayStrideUITests' do
# inherit! :search_paths
# # Pods for testing
# end
end
How i resolved it
Step one : open Podfile under ios/App/podfile
comment this lines out
#pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
#pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins'
after this, run Pod install
now should work just fine
OR, write like this, take off the CordovaPlugins, as it already installed by the first
def capacitor_pods
#Automatic Capacitor Pod dependencies, do not delete
pod 'Capacitor', :path => '../../node_modules/#capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/#capacitor/ios'
#pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
pod 'CordovaPluginsStatic', :path => '../capacitor-cordova-ios-plugins'
pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins'
# Do not delete
end

Couldn't load the Unicode tables for UTF8Handler in Rails Admin (1.2.0)

I want to upgrade rails 3 to rails 5. There I am using mongodb as database. I am using rails admin 1.2.0. I am using jruby-9.1.7.0. I am rails api only app. My application gems are given below.
gem 'rails', '~> 5.1.4'
gem 'awesome_print', '~> 1.8.0'
gem 'devise', github: 'plataformatec/devise', :branch => 'master', :ref => "463351922fdafb96c50ba2496c7d0adaa3223283"
gem "doorkeeper-mongodb", github: "doorkeeper-gem/doorkeeper-mongodb"
gem 'cancan', github: 'DevAVIJIT7/cancan', :branch => 'master', :ref => "aa3729bd79d92a993c5186f983eccd2fd496c2d3"
gem 'puma','~> 3.11.0'
gem 'mongoid', '6.2.1'
gem 'mongoid-tree', '~> 2.1.0'
gem 'rails_admin', '~> 1.2'
In my routes rails admin mount path and initializer file look like
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
RailsAdmin.config do |config|
RAILS_ADMIN_BASE_PATH = 'godview'
config.main_app_name = Proc.new do |controller|
[ "Admin", "#{controller.params[:action].try(:titleize)}" ]
end
config.authenticate_with do
authenticate_or_request_with_http_basic('Login required') do |username, password|
user = User.where(username: username).first
if user && user.valid_password?(password) && user.role_names.include?("Super Admin")
user
else
nil
end
end
end
end
when I run http://localhost:3000/admin on browser I am getting error.
In console I am getting
Started GET "/godview" for 0:0:0:0:0:0:0:1 at 2018-01-15 14:54:12
+0530
Processing by RailsAdmin::MainController#dashboard as HTML
Completed 401 Unauthorized in 263ms
IOError (Couldn't load the Unicode tables for UTF8Handler (undefined method
`call' for nil:NilClass
Did you mean? caller), ActiveSupport::Multibyte is unusable):
I went through the link Rails: Couldn't load the Unicode tables for UTF8Handler But didn't get any response.
*note : I am using /admin as /godview in my app.
Thanks
We are using Docker on CentOS for our rails projects, and we got this error recently, we fixed it by explicitly specifying the C.UTF8 encoding in the docker file as below:
ENV LANG C.UTF-8
Encoding
By default, Ruby inherits the locale of the environment in which it is run. For most users running Ruby on their desktop systems, that means it's likely using some variation of *.UTF-8 (en_US.UTF-8, etc). In Docker, however, the default locale is C, which can have unexpected results. If your application needs to interact with UTF-8, it is recommended that you explicitly adjust the locale of your image/container via -e LANG=C.UTF-8 or ENV LANG C.UTF-8
References:
https://hub.docker.com/_/ruby/
https://oncletom.io/2015/docker-encoding/

Cannot import Firebase in CocoaPod

I'm creating a CocoaPod from which I'd like to import Firebase. I get the error:
"No such module 'Firebase'"
When I add import Firebase to a Swift file in my pod.
My CocoaPod Foo's pod spec file, Foo.podspec, contains:
s.dependency 'Firebase', '~> 3.6'
It seems there is a problem with the module mapping in the podspec made by Firebase for the latest version of their pod (see https://github.com/CocoaPods/CocoaPods/issues/6138).
I am currently working on a chat system based on Firebase that I have abstracted as a private CocoaPod. If I erase all traces of Firebase in my code/ podspec, all other Pods are imported flawlessly. I don't know that there is much we can do until this is fixed.
Cheers!
I recently ran into this same problem and the solution I settled on so that I could use firebase from inside both my development pod as well as apps using it was to setup the firebase sdk inside Xcode so that it can be found in the same way that a system framework is.
Download the firebase sdk
Move the frameworks you need into Xcode /Applications/Xcode.app/Contents/Developer/Library/Frameworks/
Setup your pod spec so that it knows where the frameworks are as well as add a few required dependencies.
# Specify what libraries this depends on.
s.libraries = [
'c++', # FirebaseAnalytics.
'icucore', # FirebaseDatabase.
'sqlite3', # FirebaseAnalytics.
'z', # FirebaseAnalytics.
]
# Specify what frameworks this depends on.
s.frameworks = [
'AddressBook', # FirebaseAnalytics.
'AdSupport', # FirebaseAnalytics.
'CFNetwork', # FirebaseDatabase.
'SafariServices', # FirebaseAnalytics.
'Security', # FirebaseAnalytics, FirebaseAuth, FirebaseDatabase.
'StoreKit', # FirebaseAnalytics.
'SystemConfiguration', # FirebaseAnalytics, FirebaseDatabase.
'FirebaseAnalytics',
'FirebaseInstanceID',
'FirebaseCore',
'FirebaseCoreDiagnostics',
'FirebaseNanoPB',
'GoogleToolboxForMac',
'FirebaseAuth',
'GTMSessionFetcher',
'FirebaseDatabase'
]
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/**' }
# LDFLAGS required by Firebase dependencies.
s.pod_target_xcconfig = {
'OTHER_LDFLAGS' => '$(inherited) -ObjC',
}
This example only uses firebase Analytics, Auth and Database but I'm sure other frameworks could be added as well. It isn't the best solution but it works for my situation.

Tryint to generate "Cloud Endpoint Client Library" from Google-app-engine project failed in MAC OS X

I'm trying to generate "Cloud Endpoint Client Library" from Google App-Engine project using Eclipse plug-in, but it fails with exception: InvocationTargetException - "All API classes with the same API name and version must have the exact same API-wide configuration".
I'm using Eclipse 4.2 with Google App-Engine plug-in 1.8.3 on MAC OS X 10.8.4.
The strange thing is: on PC running Windows with same eclipse and plug-in versions, generating the libraries from the project doesn't raise any exception.
I was having the same problem.
I ended up removing the resource attribute from ALL of the endpoint classes, as it was the only difference.
#Api(name = "shoppingassistant",
// resource = "deviceinfos",
version = "v1", namespace = #ApiNamespace(ownerDomain = ApiKeysAndIds.API_OWNER, ownerName = ApiKeysAndIds.API_OWNER, packagePath = ApiKeysAndIds.API_PACKAGE_PATH), clientIds = {
ApiKeysAndIds.ANDROID_CLIENT_ID, ApiKeysAndIds.IOS_CLIENT_ID, ApiKeysAndIds.WEB_CLIENT_ID }, audiences = { ApiKeysAndIds.AUDIENCE_ID })
The project compiles now, and I was able to generate the client lib.
(I haven't tried the android project yet)
While all properties in the #Api annotation must match for all classes in an API, you can additionally use the #ApiClass annotation to provides properties that do not need to be exactly the same between classes.
For this case:
#Api(name = "shoppingassistant",
version = "v1", namespace = #ApiNamespace(ownerDomain = ApiKeysAndIds.API_OWNER,
ownerName = ApiKeysAndIds.API_OWNER, packagePath = ApiKeysAndIds.API_PACKAGE_PATH),
clientIds = {
ApiKeysAndIds.ANDROID_CLIENT_ID, ApiKeysAndIds.IOS_CLIENT_ID, ApiKeysAndIds.WEB_CLIENT_ID},
audiences = {ApiKeysAndIds.AUDIENCE_ID})
#ApiClass(resource = "deviceinfos")
Read the full tutorial here