iOS, install library via pod install, still get "No such module" - ios

Pardon me for beginner's question,
I tried to install a library named NetworkKit, and follow their instruction by doing
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'NetworkKit'
and then
pod install
but still in the swift file, I got the error "No such module" at the line import NetworkKit.
Any idea how to fix this? Thanks
Update: This is the output of pod install --verbose
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target
`Pods-networkingexamle`: (``)
Using `ARCHS` setting to build architectures of target
`Pods-networkingexamleTests`: (``)
Using `ARCHS` setting to build architectures of target
`Pods-networkingexamleUITests`: (``)
Finding Podfile changes
- NetworkKit
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
- NetworkKit
Downloading dependencies
-> Using NetworkKit (1.3.2)
- Running pre install hooks
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing targets
- Installing target `NetworkKit` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/NetworkKit/Info.plist`
- Generating module map file at `Pods/Target Support
Files/NetworkKit/NetworkKit.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/NetworkKit/NetworkKit-umbrella.h`
- Installing target `Pods-networkingexamle` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/Pods-networkingexamle/Info.plist`
- Generating module map file at `Pods/Target Support
Files/Pods-networkingexamle/Pods-networkingexamle.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/Pods-networkingexamle/Pods-networkingexamle-umbrella.h`
- Installing target `Pods-networkingexamleTests` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/Pods-networkingexamleTests/Info.plist`
- Generating module map file at `Pods/Target Support
Files/Pods-networkingexamleTests/Pods-networkingexamleTests.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/Pods-networkingexamleTests/Pods-networkingexamleTests-umbrella.h`
- Installing target `Pods-networkingexamleUITests` iOS 8.0
- Generating Info.plist file at `Pods/Target Support
Files/Pods-networkingexamleUITests/Info.plist`
- Generating module map file at `Pods/Target Support
Files/Pods-networkingexamleUITests/Pods-networkingexamleUITests.modulemap`
- Generating umbrella header at `Pods/Target Support
Files/Pods-networkingexamleUITests/Pods-networkingexamleUITests-umbrella.h`
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Generating deterministic UUIDs
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Integrating target `Pods-networkingexamle` (`networkingexamle.xcodeproj` project)
Integrating target `Pods-networkingexamleTests` (`networkingexamle.xcodeproj` project)
Integrating target `Pods-networkingexamleUITests` (`networkingexamle.xcodeproj` project)
- Running post install hooks
- cocoapods-stats from
`/Library/Ruby/Gems/2.0.0/gems/cocoapods-stats-1.0.0/lib/cocoapods_plugin.rb`
Sending stats
- NetworkKit, 1.3.2
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
Update 2:
The answer is in Thanh Pham's and Shayan Jali's comment: I have to open xcworkspace after install the pod, instead of the xcproject

Let me put the answer here for future readers:
The output of pod install --verbose indicates that the pod has been installed successfully. However, you have to open the .xcworkspace file generated by CocoaPods instead of the .xcproject file.
It is also worth mentioned that the pod can be compiled on Xcode 7 but not Xcode 8 since it has not been updated to Swift 2.3 nor 3.0 at the time of this post.

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
The NetworkKit isn't configured with the latest swift syntax. So, use this link Xcode 8 Beta 3 Use Legacy Swift issue to resolve it.

It is import NewsstandKit, the import NewtworkKit is not working.

Related

Pods not found after creating new schemes?

I've just decided to create a couple of different schemes with different configurations. However it get "No such module 'podname'", when I try to build it.
I've followed this guide, and tried to build just before the steps where you add configuration files. Any ideas why my pods doesn't get recognised? The new schemes I've created is name "development", "test" and "production".
This is how my podfile looks like:
When I run Pod install, I get the following messages:
[!] Automatically assigning platform `ios` with version `10.0` on target `NoteIt` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `NoteIt` to `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (development).xcconfig` or include the `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (development).xcconfig` in your build configuration (`NoteIt/Development.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `NoteIt` to `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (test).xcconfig` or include the `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (test).xcconfig` in your build configuration (`NoteIt/Test.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `NoteIt` to `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (production).xcconfig` or include the `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (production).xcconfig` in your build configuration (`NoteIt/Production.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `NoteIt` to `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(development).xcconfig` or include the `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(development).xcconfig` in your build configuration (`NoteIt/Development.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `NoteIt` to `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(test).xcconfig` or include the `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(test).xcconfig` in your build configuration (`NoteIt/Test.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `NoteIt` to `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(production).xcconfig` or include the `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(production).xcconfig` in your build configuration (`NoteIt/Production.xcconfig`).
[!] The `NoteIt [Debug (Development)]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (development).xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `NoteIt [Debug (Test)]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (test).xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `NoteIt [Debug (Production)]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (production).xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `NoteIt [Release(Development)]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(development).xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `NoteIt [Release(Test)]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(test).xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `NoteIt [Release(Production)]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release(production).xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
And I get the following error when I build after a clean:
My configurations settings looks like this:
Delete the .xcworkspace, Podfile.lockand Pods/ directory. Once Done do
pod install
Now, open the newly generated .xcworkspace file and add the .xcconfig path for Cocoapods in your own .xcconfig file.
For more details regarding solving this issue, you can refer to link.
This would solve the problem.
Happy Coding :)
I replicated your issue and got the same error "sandbox not in sync with Podfile.lock"
Even after the .xcworkspace, Pod folders and Pod related phases got the same error, so taking a closer look on the error, I found out that it wasn't finding the Pods .xcconfig files. However, looking at the Pods folder, at the path Pods/Target Support Files/Pods-NoteIt, I saw that these files where indeed there:
> Pods-NoteIt.debug (beta) Pods-NoteIt.debug (development).xcconfig
> Pods-NoteIt.debug (production) Pods-NoteIt.debug (qa)
> Pods-NoteIt.debug (uat) Pods-NoteIt.debug
>
> Pods-NoteIt.release (beta) Pods-NoteIt.release (development)
> Pods-NoteIt.release (production) Pods-NoteIt.release (qa)
> Pods-NoteIt.release (uat) Pods-NoteIt.release
>
> Pods-NoteIt.debug (beta).xcconfig Pods-NoteIt.debug
> (development).xcconfig Pods-NoteIt.debug (production).xcconfig
> Pods-NoteIt.debug (qa).xcconfig Pods-NoteIt.debug (uat).xcconfig
> Pods-NoteIt.debug.xcconfig
>
> Pods-NoteIt.release (beta).xcconfig Pods-NoteIt.release
> (development).xcconfig Pods-NoteIt.release (production).xcconfig
> Pods-NoteIt.release (qa).xcconfig Pods-NoteIt.release (uat).xcconfig
> Pods-NoteIt.release.xcconfig
What I did was to include the required files on each .xcconfig what I created manually. So for example, on the Development.xcconfig I added the following:
#include "Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.debug (uat).xcconfig"
#include "Pods/Target Support Files/Pods-NoteIt/Pods-NoteIt.release (uat).xcconfig"
So your file would look liket this, if you added some other variables like the one in the tutorial:
After repeating this for each .xcconfig (Development, Production, QA, Beta, UAT) I was able to build and run the project succesfully.
From another post, of syncing podfile.lock, the solution was:
pod deintegrate --verbose
pod install --verbose
if that doesn't work, simply follow the error code and reinstall coca-pods
link to the question The sandbox is not in sync with the Podfile.lock-ios
I had this same issue. I resolved it by deleting all pod files and the derived data folder from my project. Uninstalled all pods from my machine. Then I reinstalled them.
sudo gem uninstall cocoapods
sudo gem install cocoapods
pod init
pod install
in pod file, add target for each schema
Try something like this:
def shared_pods
pod 'SideMenuSwift'
pod 'Alamofire'
pod 'ObjectMapper'
pod 'SwiftDate'
pod 'NVActivityIndicatorView'
pod 'SwiftyUserDefaults'
end
target 'Target1' do
shared_pods
end
target 'Target2' do
shared_pods
end

Working process of pod install command in iOS

I have one doubt about cocoapod. Nowadays we are using dependency manager cocoapod for adding libraries to our project.
For example I added pod 'Alamofire' command in podfile and i run pod install command in my terminal.Then automatically added Alamofire library to our xcode project.This is working fine.
But my doubt is we are mentioned only pod 'Alamofire' in podfile, then how to download this exact library from this single line command? What is the process done in background when i run pod install command?
When you mention just the name of the repository in podfile. It automatically checks the latest version of the library present on GitHub and downloads it.
Here is the detailed log of what happens when you install a pod.
Analyzing dependencies
Updating spec repositories
Updating spec repo `master`
$ /usr/bin/git pull
Already up-to-date.
Finding Podfile changes
- AFNetworking
- HockeySDK
Resolving dependencies of `Podfile`
Resolving dependencies for target `Pods' (iOS 6.0)
- AFNetworking (= 1.2.1)
- SDWebImage (= 3.2)
- SDWebImage/Core
Comparing resolved specification to the sandbox manifest
- AFNetworking
- HockeySDK
Downloading dependencies
-> Using AFNetworking (1.2.1)
-> Using HockeySDK (3.0.0)
- Running pre install hooks
- HockeySDK
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-AFNetworking` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-AFNetworking.xcconfig`
- Generating private xcconfig file at `Pods/Pods-AFNetworking-Private.xcconfig`
- Generating prefix header at `Pods/Pods-AFNetworking-prefix.pch`
- Generating dummy source file at `Pods/Pods-AFNetworking-dummy.m`
- Installing target `Pods-HockeySDK` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-HockeySDK.xcconfig`
- Generating private xcconfig file at `Pods/Pods-HockeySDK-Private.xcconfig`
- Generating prefix header at `Pods/Pods-HockeySDK-prefix.pch`
- Generating dummy source file at `Pods/Pods-HockeySDK-dummy.m`
- Installing target `Pods` iOS 6.0
- Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target environment header at `Pods/Pods-environment.h`
- Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
- Generating acknowledgements at `Pods/Pods-acknowledgements.markdown`
- Generating dummy source file at `Pods/Pods-dummy.m`
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Please refer to this Link for a detailed version of how CocoaPods work.

Running Cocoapods "pod install" Causes Libraries to Disappear

We are having a problem with an existing project. Running pod install causes our existing Pods to break.
Our existing project looks like this:
After I run pod install, several of the libraries that appear in the Products directory and under the Targets are gone, and the app won't compile:
Here is the output from pod install --verbose
myapp-Macbook-Air:myapp username$ pod install --verbose
Preparing
Updating local specs repositories
Updating spec repo `master`
$ /usr/bin/git pull --ff-only
Already up-to-date.
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods`:
(`$(ARCHS_STANDARD)`)
Finding Podfile changes
- Dropbox-iOS-SDK
- FiksuSDK
- GoogleAnalytics
- Localytics
- MobileAppTracker
- SDWebImage
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
- Dropbox-iOS-SDK
- FiksuSDK
- GoogleAnalytics
- Localytics
- MobileAppTracker
- SDWebImage
Downloading dependencies
-> Using Dropbox-iOS-SDK (1.3.13)
-> Using FiksuSDK (4.4.1)
-> Using GoogleAnalytics (3.13.0)
-> Using Localytics (3.5.0)
-> Using MobileAppTracker (3.7)
-> Using SDWebImage (3.7.2)
- Running pre install hooks
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing targets
- Installing target `SDWebImage` iOS 7.0
- Installing target `Pods` iOS 7.0
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Generating deterministic UUIDs
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Integrating target `Pods` (`myapp.xcodeproj` project)
Adding Build Phase 'Embed Pods Frameworks' to project.
- Running post install hooks
- cocoapods-stats from
`/usr/local/lib/ruby/gems/2.1.0/gems/cocoapods-stats-0.6.2/lib/cocoapods_plugin.rb`
Sending stats
- Dropbox-iOS-SDK, 1.3.13
- FiksuSDK, 4.4.1
- GoogleAnalytics, 3.13.0
- Localytics, 3.5.0
- MobileAppTracker, 3.7
- SDWebImage, 3.7.2
Pod installation complete! There are 6 dependencies from the Podfile and 6
total pods installed.
[!] The `myapp [Debug]` target overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
(We've always had that GCC_PREPROCESSOR warning)
Any ideas about what be happening here, would be appreciated.
Some other notes: We are having this problem on Xcode 6 and Xcode 7, but both machines are running OS X 10.11, which might be the problem. Cocoapods v0.39.0. Also tried downgrading to Cocoapods v0.25.0 but the same problem occurs.

CocoaPods Error (PubNub) with iOS Static Library Project

I'm working on iOS Static Library Project (9.0). I've decided to include PubNub to my Static Library Project. Steps I followed;
I've downloaded PubNub sample project and builded.
I've copied Framework files (CocoaLumberjack and PubNub) into my Supporting Files folder.
I've closed xCode, and created PodFile in project directory.
Content of PodFile is as follows:
platform :ios, "9.0"
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod "PubNub", "~> 4.0"
After installation i get warning for both Debug and Release says;
[!] The xxxIOSFramework [Debug] target overrides the OTHER_LDFLAGS build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
I've opened .xcworkspace and saw both my project and Pods project in tree.
At this point build gives error ld: framework not found Pods
After my re-searches, most says that remove Pods.framework which is highlighted in red, and i did.
After removing Pods.framework, build continues to give error such as; ld: -rpath can only be used when creating a dynamic final linked image
I've moved to Target > Build Settings > Other Linker Flags. ObjC was added, and I also added $(inherited) but error still exists.
Anyone have any idea about getting -rpath can only be used when creating a dynamic final linked image error while adding Cocoapods to iOS Static Library Project? I can provide additional information if you need.
Thank you.
Getting started describes few integration ways and from your question it looks like you used bot of them at once.
If you want to build own static library and integrate PubNub and CocoaLumberjack in it, you should stick to pure CocoaPods approach.
You need to:
Remove added dynamic PubNub and CocoaLumberjack frameworks
Remove !use_framewors from Podfile
Clean up a bit (if you have deintegrate plugin installed for CocoaPods you can call it) by removing workspace, Pods folder and Podfile.lock
Run pod install
This way you should be able to build your own static library with PubNub client code inside.

Undefined symbols for architecture armv7 for Cocoapods libraries

I stumbled upon a problem on a project that I need to work on. The project use Cocoapods for managing its libraries. I run pod install as usual to get started but xcode give me errors. I got Undefined symbols for architecture armv7 as you can see in the image below:
All this symbols are the libraries that I use with my project. Eg. AFNetworking, RNBlurModalView. I tried to remove all the Cocoapods related file from the project and running pod install again, but it still doesn't solved the problem.
What I have done so far:
Clean the project and build again.
Removing Cocoapods related files and running pod install again.
Tried to add the class in Compile Sources in Project Target, but can't. The class is in Pods workspace.
Set Build Active Architecture Only from YES to NO.
I also try the solutions from the same problem, but none of it is working for me.
If it helps, I'm using xCode6 and Cocoapods 0.34.4. The project valid architectures is armv7 and armv7s.
Update: When running pod install --verbose
Integrating client project
Integrating target `Pods` (`AIYOCore.xcodeproj` project)
[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
[!] The `Project [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Project [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
Thanks in advance.
It seems like you don't have $(inherited) in OTHER LINKER FLAGS. Please post output of the pod install
You may just need to clean the build folder (⌥⇧⌘K).

Resources