Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 621 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'No such module' when I use CocoaPods

#1
So here's my procedure. I create a new `Podfile` in the project directory, then I added the following

platform :ios, '9.0'
use_frameworks!

target 'CPod' do
pod 'AFNetworking', '~> 2.5'
pod 'ORStackView', '~> 2.0'
pod 'SwiftyJSON', '~> 2.1'
end

I fire off `pod install`, and everything goes well, open up the `xcworkspace`. I then go over to `ViewController.swift` and if I try to import a pod I get `No such module 'SwiftyJSON'`, if I were to do `import SwiftyJSON`. Any ideas?

EDIT: SwiftyJSON is a Swift based module, not Obj-C
Reply

#2
For me, removing the following from my `podFile` fixed it:

installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
Reply

#3
i fixed it by check "Find Implicit Dependencies" to true.
Go to Edit Scheme -> Build Tab -> set Find Implicit Dependencies = true.

and rebuild.

[![enter image description here][1]][1]


[1]:
Reply

#4
If you see this warning:


[!] The `Joint [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Joint/Pods-Joint.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

[!] The `Joint [Release]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Joint/Pods-Joint.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

follow the instructions to avoid `Module not found` issue.
Reply

#5
Another way this issue can manifest: if you have multiple targets with different platforms (e.g. iOS and watchOS) you need to make sure your podfile specifies the correct platform for each target. Otherwise Cocoapods might be building the right pod but for wrong platform, leading to the "no such module" error.

You can fix it just by specifying the correct platforms e.g.

```ruby
# global platform
platform :ios, '11.0'

target 'My Framework' do
use_frameworks!

pod 'RxSwift', '~> 5.1'
end

target 'My Framework (watchOS)' do
# override global platform for this target
platform :watchos, '4.0'

use_frameworks!

pod 'RxSwift', '~> 5.1'
end
```
Reply

#6
In my case it was because I opened `xcodeproj` instead of the correct `xcworkspace`.
Reply

#7
Had this issue, too. I noticed the folder in `Pods/broken_framework_name` for framework which produced an error was empty even after pod install or pod update. So, for me those steps helped:

1. close `XCode` completely
2. remove `DerivedData`
3. remove `Podfile.lock`. Before doing it, make sure your pods are set to specific versions and it will not cause unwanted code updates
4. run `pod deintegrate`
5. remove `.xcworkspace` file
6. probably optional step: I had general line `use_frameworks!` written before all targets, but included it also in target in which I had an error
7. run `pod install`

After all steps I noticed missing framework files finally appeared back and build was working again.
Reply

#8
I get some warning when pod install: '... target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in ...'.

Fix it and enjoy.

Reference:

[To see links please register here]

.
Reply

#9
Those who working with multiple targets , please don't forget to add this line in pods


def shared_pods
pod 'SSKeychain', '~> 0.1.4'
pod 'INAppStoreWindow', :head
pod 'AFNetworking', '1.1.0'
pod 'Reachability', '~> 3.1.0'
pod 'KSADNTwitterFormatter', '~> 0.1.0'
pod 'MASShortcut', '~> 1.1'
pod 'MagicalRecord', '2.1'
pod 'MASPreferences', '~> 1.0'
end

target 'Target_Name' do
shared_pods
end

target 'Target_Name_Two' do
shared_pods
end
Reply

#10
My setup

- macOS 10.14 Mojave
- Xcode 10.3
- cocoapods 1.7.5

None of the answers work for me, although some gave partial clues. In my case, the root cause was that I customized my build product paths **after running `pod install`**.

If you run cocoapods right after creating an Xcode project, then it usually works if you open the generated Xcode `.xcworkspace` instead of the `.xcodeproj`.

Funny things happen if you start tweaking your build product paths **after generating the workspace**. Because the generated Pods project and its target all refer to your old Xcode project settings.

In my case, my trouble came from:

- I prefer all my build products sitting under the project folder `$(SRCROOT)/build/$(CONFIGURATION)/$(EFFECTIVE_PLATORM_NAME)`. So I went ahead and changed my `Pre-configuration Build Products Path` to it .... **AFTER doing `pod install`**.

Now, the generated `Pods` project, including all its Framework target, still points to the old location, so both the header import and linking of your own project will fail (you'd see `Command PhaseScriptExecution failed with a nonzero exit code` when `No such module` is fixed).

**The fix:**

- Delete all Pods stuff including the workspace.
- Regenerate `Pods` project and workspace with `pod install`. However, cocoapods hardcodes the build product path to `${SRCROOT}/../build` and `Pre-configuration Build Products` to `$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)` in my case, which usually points to a temporary `~/Library/Developer` subfolder . Still not quite right. Then ....
- Make sure the `Framework Search Path` and `Header Search Path` of my own project cover the above paths.
- Tweak `Pods` project setting and all dependency Framework's `Pre-configuration Build Products Path` to use my preferred paths.

The moral lesson: **Always regenerate Pods and verify the key result paths whenever you touch paths in Xcode project settings.**

**UPDATE**

With Xcode 11, Apple finally removed the confusing "Pre-configuration Build Products Path". To customize the build product paths, use `Locations` in Xcode preferences with global relative paths pre-baked.

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through