xcode cocoapods 找不到模拟器,pod repo 推送失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52742003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:50:42  来源:igfitidea点击:

cocoapods can't find simulators, pod repo push fails

xcodecocoapods

提问by Dan Morrow

I'm trying to push a private pod. When I do it, I get this error:

我正在尝试推送一个私人吊舱。当我这样做时,我收到此错误:

- ERROR | [iOS] unknown: Encountered an unknown error (Could not find aiossimulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least oneiossimulator listed or otherwise add one.) during validation.

- ERROR | [iOS] unknown: Encountered an unknown error (Could not find aios simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least oneiossimulator listed or otherwise add one.) during validation.

I'm running Xcode 10, andI recently had Xcode 10.1 betaon my machine. Also, I had regular cocoapods (1.5.3) and the latest beta of that (1.6.0.beta.1).

我跑的Xcode 10我最近的Xcode 10.1测试版我的机器上。另外,我有普通的 cocoapods (1.5.3) 和最新的测试版 (1.6.0.beta.1)。

To reduce complexity, I removed both betasfrom my machine. So, just the released versions. I'm still seeing this error.

为了降低复杂性,我从我的机器中删除了两个测试版。所以,只是发布的版本。我仍然看到这个错误。

I can't imagine what could've happened here. But somethingis out of whack. I'd really prefer to notcompletely remove Xcode, or do something else more drastic. But I'm totally stuck.

我无法想象这里会发生什么。但有些事情不正常。我真的不想完全删除 Xcode,或者做一些更激烈的事情。但我完全被困住了。

Other people on my team are able to pull the code, and do a pod repo push, but I can't from my own machine.

我团队中的其他人能够提取代码并执行 . pod repo push,但我不能从我自己的机器上执行。

Thanks for any help/advice.

感谢您的任何帮助/建议。

采纳答案by Pavlo Boiko

If you have Xcode 10.1 installed, _even if Xcode 10.0 is set as the default version of Xcode, the output from simctlhas a different format, specifically for availability. The rest of the fields appear to be the same, just not this one. You can see this JSON calling xcrun simctl list -j. And Cocoapods do not update their wrapper to this format yet.

如果您安装了 Xcode 10.1,即使 Xcode 10.0 被设置为 Xcode 的默认版本,输出也会simctl有不同的格式,特别是为了可用性。其余字段似乎相同,只是不是这个字段。你可以看到这个 JSON 调用xcrun simctl list -j。并且 Cocoapods 尚未将其包装器更新为这种格式。

I prepared temporarystep-to-spet Hotfix of this issue. It work`s for me.

我准备了这个问题的临时step-to-spet 修补程序。它对我有用。

In log find this line - ERROR | [iOS] unknown: Encountered an unknown error (Could not find aiossimulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least oneiossimulator listed or otherwise add one.

在日志中找到这一行- ERROR | [iOS] unknown: Encountered an unknown error (Could not find aios simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least oneiossimulator listed or otherwise add one.

Under it you will see such line: /usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb.

在它下面你会看到这样的行:/usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb

  1. Copy name of this file and call: sudo vi /usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
  2. Press I
  3. In end of file find line with starts with Simulator.new(device, os_name, os_version)....
  4. Replace this line with Simulator.new(device, os_name, os_version) if device['availability'] == '(available)' || device['isAvailable'] == 'YES'
  5. Press :wq
  6. pod trunk push YourLibrary.podspecshould work.
  1. 复制此文件的名称并调用: sudo vi /usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
  2. I
  3. 在文件末尾找到以Simulator.new(device, os_name, os_version)...开头的行
  4. 将此行替换为 Simulator.new(device, os_name, os_version) if device['availability'] == '(available)' || device['isAvailable'] == 'YES'
  5. :wq
  6. pod trunk push YourLibrary.podspec应该管用。

If something does not work, please reply.

如果有什么不起作用,请回复。

回答by Hitendra Solanki

do below steps it solved my issue For XCode 10.X and 11.X

执行以下步骤它解决了我的问题对于 XCode 10.X 和 11.X

  1. sudo gem update cocoapods
  1. sudo gem 更新 cocoapods

If above will not work for your system, follow the below 3 steps, it will surely work

如果以上对您的系统不起作用,请按照以下 3 个步骤操作,它肯定会起作用

  1. sudo gem uninstall fourflusher
  2. sudo gem install fourflusher
  3. sudo gem update cocoapods
  1. sudo gem 卸载fourflusher
  2. 须藤宝石安装fourflusher
  3. sudo gem 更新 cocoapods

回答by Richard Chirino

I got this error after running the Xcode 10.2 beta. Unfortunately the previous answers didn't make the error go away. I don't know exactly what changed but I found a workaround to get it working:

运行 Xcode 10.2 beta 后出现此错误。不幸的是,之前的答案并没有使错误消失。我不知道到底发生了什么变化,但我找到了一种解决方法来让它工作:

  1. Find the find.rbof fourflusher, you can tell by the location on the error after running the pod trunk pushcommand. Something like: /usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
  2. Go to the end of the file around if device['availability'] == '(available)'
  3. Right below that make sure os_nameand os_versionare set. If you look in the comment above it expects to split # Sample string: iOS 9.3into iOSand 9.3. In my case they were empty or something else so I set them myself.
  4. Also check the availability against true: || device['isAvailable'] == true
  1. 找到find.rbfourflusher,您可以在运行后通过在错误的位置告诉pod trunk push命令。就像是:/usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
  2. 转到文件末尾 if device['availability'] == '(available)'
  3. 正下方确保os_nameos_version设置。如果您查看上面的评论,它预计会拆分# Sample string: iOS 9.3iOS9.3。就我而言,它们是空的或其他东西,所以我自己设置了它们。
  4. 还要根据 true 检查可用性: || device['isAvailable'] == true

In the end that part looks like this:

最后那部分看起来像这样:

if device['availability'] == '(available)' || device['isAvailable'] == true
  os_name = "iOS"
  os_version = "12.1"
  Simulator.new(device, os_name, os_version)
end

THIS IS NOT A PERMANENT SOLUTION!!! It's just how I got it to work for now until what changed in the Xcode 10.2 beta is officially supported by cocoapods.

这不是一个永久性的解决方案!!!这就是我现在让它工作的方式,直到 Xcode 10.2 beta 中的更改得到 cocoapods 的正式支持。

I noticed then when you run xcrun simctl list -jon a mac that never installed the beta you have os names like com.apple.CoreSimulator.SimRuntime.iOS-12-1and iOS 12.1.

我注意到,当您xcrun simctl list -j在从未安装过测试版的 Mac 上运行时,您的操作系统名称类似于com.apple.CoreSimulator.SimRuntime.iOS-12-1iOS 12.1

After installing the Xcode 10.2 I still see the com.apple.CoreSimulator.SimRuntime.iOS-12-1but the iOS 12.1one is gone. I'm assuming find.rbused the the latter to find the os_nameand os_versionvalues. This is why I set them myself.

安装 Xcode 10.2 后,我仍然看到,com.apple.CoreSimulator.SimRuntime.iOS-12-1但那个iOS 12.1已经不见了。我假设find.rb使用后者来查找os_nameos_version值。这就是我自己设置它们的原因。

Hope this helps other people, good luck!

希望这可以帮助其他人,祝你好运!

回答by Rebeloper

After installing Xcode11-beta had the same issue:

安装 Xcode11-beta 后也有同样的问题:

- ERROR | [iOS] unknown: Encountered an unknown error (Could not find aiossimulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least oneiossimulator listed or otherwise add one.) during validation.

- ERROR | [iOS] unknown: Encountered an unknown error (Could not find aiossimulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least oneiossimulator listed or otherwise add one.) during validation.

Solved it by following these steps:

通过以下步骤解决了它:

  1. In the Finder Menu select Go/Go to Folder...
  2. Paste in /usr/local/lib/ruby/gems
  3. Navigate to {your gem version}/gems/fourflusher-{version}/lib/fourflusher/
  4. Open Terminal
  5. Type in cd(cd and a space)
  6. Drag and drop the fourflusherfolder (the one that has the find.rbfile)
  7. Type in sudo vi find.rb
  8. Type in your password
  9. Type in ito be able to edit the file
  10. Scroll all the way down in the file till you see device['availability'] == '(available)' || device['isAvailable'] == 'YES'
  11. Append to this line the following: || device['isAvailable'] == true
  12. Now it should look like this:
  1. 在 Finder 菜单中选择 Go/Go to Folder...
  2. 粘贴 /usr/local/lib/ruby/gems
  3. 导航 {your gem version}/gems/fourflusher-{version}/lib/fourflusher/
  4. 打开终端
  5. 输入cd(cd 和一个空格)
  6. 拖放fourflusher文件夹(包含find.rb文件的文件夹)
  7. 输入 sudo vi find.rb
  8. 输入您的密码
  9. 输入i即可编辑文件
  10. 在文件中一直向下滚动,直到看到 device['availability'] == '(available)' || device['isAvailable'] == 'YES'
  11. 将以下内容附加到此行: || device['isAvailable'] == true
  12. 现在它应该是这样的:
devices.map do |device|
          if device['availability'] == '(available)' || device['isAvailable'] == 'YES' || device['isAvailable'] == true
            Simulator.new(device, os_name, os_version)
          end
        end
  1. Type in :wqto save the file
  2. Navigate to your .podspec file folder
  3. Run pod lib lintto lint it or pod trunk pushto push it
  1. 输入:wq以保存文件
  2. 导航到您的 .podspec 文件夹
  3. 运行pod lib lint以整理或pod trunk push推动它

If you mistyped something or just want to totally start all over again you should uninstall and install fourflusherlike so before starting all over agin from step 1:

如果您输入错误或只是想从头开始,您应该fourflusher像这样卸载并安装,然后再从第 1 步开始重新开始:

Uninstall: sudo gem uninstall fourflusher

卸载: sudo gem uninstall fourflusher

Install: sudo gem install fourflusher

安装: sudo gem install fourflusher

回答by Robert-Hein Hooijmans

I had the same problem, updating all gems worked for me: sudo gem update

我遇到了同样的问题,更新所有对我有用的宝石: sudo gem update

回答by Tai Le

I was using CocoaPodswith 1.7.1, then I did update to 1.7.2and the problem gone

我正在使用CocoaPodswith 1.7.1,然后我确实更新了1.7.2并且问题消失了

sudo gem install cocoapods 

回答by user10390875

even i try to use $gem insall cocoapods but cocoapods version is still the low version , at last i find the way to update your cocoapods

即使我尝试使用 $gem insall cocoapods 但 cocoapods 版本仍然是低版本,最后我找到了更新你的 cocoapods 的方法

$ sudo gem install -n /usr/local/bin cocoapods --pre 

and then my cocoapod --versionshow out is 1.7.1wonderful so i fix the question!

然后我的cocoapod --version表演是1.7.1精彩所以我解决了这个问题!

回答by Roman Podymov

I was able to reproduce this issue when I installed Xcode 10.1, Xcode 10.2 and CocoaPods 1.7.0.beta.3 on my Mac. I run pod lib lint MyLibrary.podspecand got the same error message as you mentioned in your question.

当我在 Mac 上安装 Xcode 10.1、Xcode 10.2 和 CocoaPods 1.7.0.beta.3 时,我能够重现这个问题。我运行pod lib lint MyLibrary.podspec并收到与您在问题中提到的相同的错误消息。

Fixed it by running sudo xcode-select -s /Path/To/Xcode10_1.app, where /Path/To/Xcode10_1.appis the path to Xcode 10.1.

通过运行修复它sudo xcode-select -s /Path/To/Xcode10_1.app,其中/Path/To/Xcode10_1.app是 Xcode 10.1 的路径。

To make sure that you are using the latest CocoaPods version try bundler. Create Gemfile with the following content:

要确保您使用的是最新的 CocoaPods 版本,请尝试bundler。使用以下内容创建 Gemfile:

source 'https://rubygems.org'
gem 'cocoapods', '1.7.0.beta.3'

After that run bundle install && bundle exec pod repo push(or any other pod action).

在那之后运行bundle install && bundle exec pod repo push(或任何其他 pod 操作)。