在Swift 3.0上没有这样的模块'SwiftyJSON'

时间:2023-01-12 20:34:28

After migrating to Swift 3.0, I am trying to import SwiftyJSON into my project. However, when I import the framework 'import SwiftyJSON' I get a No Such Module error.

迁移到Swift 3.0后,我试图将SwiftyJSON导入到我的项目中。但是,当我导入框架'import SwiftyJSON'时,我得到No Such Module错误。

If I remove the import statement, it does not recognize its classes.

如果我删除import语句,它将无法识别其类。

Any advice as to why XCode might not be reading my imported framework?

有关为什么XCode可能不会读取我导入的框架的任何建议?

See screenshots attached:

查看附件截图:

在Swift 3.0上没有这样的模块'SwiftyJSON'

在Swift 3.0上没有这样的模块'SwiftyJSON'

在Swift 3.0上没有这样的模块'SwiftyJSON'

9 个解决方案

#1


19  

My problem was I was opening the project file and not the workspace file...

我的问题是我打开了项目文件而不是工作区文件......

#2


8  

Try to check Targets-> Build Phases Link Binary With Libraries There must be a link with SwiftyJSON 在Swift 3.0上没有这样的模块'SwiftyJSON'

尝试检查目标 - >构建阶段链接二进制文件库必须有一个SwiftyJSON链接

#3


8  

Updating my pod to reference the official SwiftyJSON gem worked for me! It updated from version 2.3.2 (what was installed by default via 'pod SwiftyJSON') to version 3.1.1.

更新我的pod以引用官方的SwiftyJSON gem为我工作!它从版本2.3.2(默认情况下通过'pod SwiftyJSON'安装)更新到版本3.1.1。

So, in your Podfile, udpate your SwiftyJSON pod to:

因此,在您的Podfile中,将您的SwiftyJSON pod添加到:

 pod 'SwiftyJSON', :git =>'https://github.com/SwiftyJSON/SwiftyJSON.git'

HTH

HTH

#4


5  

Clean your project and build again. Make sure you open project.xcworkspace.

清理您的项目并重新构建。确保打开project.xcworkspace。

pod 'SwiftyJSON'

#5


3  

remove import SwiftyJSON to solve No such Module 'SwiftyJSON' on Swift 3.0

删除导入SwiftyJSON以解决Swift 3.0上没有这样的模块'SwiftyJSON'

Swift can load the SwiftyJSON.swift by itself. No need to specify it at import statement.

Swift可以自己加载SwiftyJSON.swift。无需在import语句中指定它。

Ref: https://github.com/SwiftyJSON/SwiftyJSON/issues/49

参考:https://github.com/SwiftyJSON/SwiftyJSON/issues/49

#6


2  

Try this.

尝试这个。

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'Project names' do
  pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git', branch: 'swift3'    
end

post_install do |installer|
   installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
           config.build_settings['SWIFT_VERSION'] = '3.0'
       end
   end
end

#7


1  

If you have multiple targets, try building each of them. I had two targets - one would build and the other would not. This may help you trace the issue.

如果您有多个目标,请尝试构建每个目标。我有两个目标 - 一个将构建,另一个不会。这可以帮助您跟踪问题。

In my case I just nuked my dev target that was not working, duplicated the production target, made a few settings changes, and was back in action.

在我的情况下,我只是修改了我的开发目标,该目标无效,复制了生产目标,进行了一些设置更改,然后重新开始运行。

#8


0  

clean your project and than build and run your project and than not work so remove your swiftyjson cocoa library in u r cocoapods and reinstall it should surely work and this 100% work for me ..so u try this.

清理你的项目,而不是建立和运行你的项目,而不是工作,所以删除你的cocoapods中的swiftyjson可可库,并重新安装它应该肯定工作,这100%适合我..所以你试试这个。

#9


0  

This solution helped me. Build the modules individually, and then build your project.

这个解决方案帮了我单独构建模块,然后构建项目。

https://*.com/a/37732248/4899943

https://*.com/a/37732248/4899943

#1


19  

My problem was I was opening the project file and not the workspace file...

我的问题是我打开了项目文件而不是工作区文件......

#2


8  

Try to check Targets-> Build Phases Link Binary With Libraries There must be a link with SwiftyJSON 在Swift 3.0上没有这样的模块'SwiftyJSON'

尝试检查目标 - >构建阶段链接二进制文件库必须有一个SwiftyJSON链接

#3


8  

Updating my pod to reference the official SwiftyJSON gem worked for me! It updated from version 2.3.2 (what was installed by default via 'pod SwiftyJSON') to version 3.1.1.

更新我的pod以引用官方的SwiftyJSON gem为我工作!它从版本2.3.2(默认情况下通过'pod SwiftyJSON'安装)更新到版本3.1.1。

So, in your Podfile, udpate your SwiftyJSON pod to:

因此,在您的Podfile中,将您的SwiftyJSON pod添加到:

 pod 'SwiftyJSON', :git =>'https://github.com/SwiftyJSON/SwiftyJSON.git'

HTH

HTH

#4


5  

Clean your project and build again. Make sure you open project.xcworkspace.

清理您的项目并重新构建。确保打开project.xcworkspace。

pod 'SwiftyJSON'

#5


3  

remove import SwiftyJSON to solve No such Module 'SwiftyJSON' on Swift 3.0

删除导入SwiftyJSON以解决Swift 3.0上没有这样的模块'SwiftyJSON'

Swift can load the SwiftyJSON.swift by itself. No need to specify it at import statement.

Swift可以自己加载SwiftyJSON.swift。无需在import语句中指定它。

Ref: https://github.com/SwiftyJSON/SwiftyJSON/issues/49

参考:https://github.com/SwiftyJSON/SwiftyJSON/issues/49

#6


2  

Try this.

尝试这个。

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'Project names' do
  pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git', branch: 'swift3'    
end

post_install do |installer|
   installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
           config.build_settings['SWIFT_VERSION'] = '3.0'
       end
   end
end

#7


1  

If you have multiple targets, try building each of them. I had two targets - one would build and the other would not. This may help you trace the issue.

如果您有多个目标,请尝试构建每个目标。我有两个目标 - 一个将构建,另一个不会。这可以帮助您跟踪问题。

In my case I just nuked my dev target that was not working, duplicated the production target, made a few settings changes, and was back in action.

在我的情况下,我只是修改了我的开发目标,该目标无效,复制了生产目标,进行了一些设置更改,然后重新开始运行。

#8


0  

clean your project and than build and run your project and than not work so remove your swiftyjson cocoa library in u r cocoapods and reinstall it should surely work and this 100% work for me ..so u try this.

清理你的项目,而不是建立和运行你的项目,而不是工作,所以删除你的cocoapods中的swiftyjson可可库,并重新安装它应该肯定工作,这100%适合我..所以你试试这个。

#9


0  

This solution helped me. Build the modules individually, and then build your project.

这个解决方案帮了我单独构建模块,然后构建项目。

https://*.com/a/37732248/4899943

https://*.com/a/37732248/4899943