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
cocoapods can't find simulators, pod repo push fails
提问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 a
iossimulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one
iossimulator listed or otherwise add one.) during validation.
- ERROR | [iOS] unknown: Encountered an unknown error (Could not find a
ios simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one
iossimulator 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 simctl
has 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 a
iossimulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one
iossimulator listed or otherwise add one.
在日志中找到这一行- ERROR | [iOS] unknown: Encountered an unknown error (Could not find a
ios simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one
iossimulator 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
。
- 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
- Press
I
- In end of file find line with starts with
Simulator.new(device, os_name, os_version)
.... - Replace this line with
Simulator.new(device, os_name, os_version) if device['availability'] == '(available)' || device['isAvailable'] == 'YES'
- Press
:wq
pod trunk push YourLibrary.podspec
should work.
- 复制此文件的名称并调用:
sudo vi /usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
- 按
I
- 在文件末尾找到以
Simulator.new(device, os_name, os_version)
...开头的行 - 将此行替换为
Simulator.new(device, os_name, os_version) if device['availability'] == '(available)' || device['isAvailable'] == 'YES'
- 按
:wq
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
- sudo gem update cocoapods
- sudo gem 更新 cocoapods
If above will not work for your system, follow the below 3 steps, it will surely work
如果以上对您的系统不起作用,请按照以下 3 个步骤操作,它肯定会起作用
- sudo gem uninstall fourflusher
- sudo gem install fourflusher
- sudo gem update cocoapods
- sudo gem 卸载fourflusher
- 须藤宝石安装fourflusher
- 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 后出现此错误。不幸的是,之前的答案并没有使错误消失。我不知道到底发生了什么变化,但我找到了一种解决方法来让它工作:
- Find the
find.rb
offourflusher
, you can tell by the location on the error after running thepod trunk push
command. Something like:/usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
- Go to the end of the file around
if device['availability'] == '(available)'
- Right below that make sure
os_name
andos_version
are set. If you look in the comment above it expects to split# Sample string: iOS 9.3
intoiOS
and9.3
. In my case they were empty or something else so I set them myself. - Also check the availability against true:
|| device['isAvailable'] == true
- 找到
find.rb
的fourflusher
,您可以在运行后通过在错误的位置告诉pod trunk push
命令。就像是:/usr/local/lib/ruby/gems/2.5.0/gems/fourflusher-2.0.1/lib/fourflusher/find.rb
- 转到文件末尾
if device['availability'] == '(available)'
- 正下方确保
os_name
和os_version
设置。如果您查看上面的评论,它预计会拆分# Sample string: iOS 9.3
为iOS
和9.3
。就我而言,它们是空的或其他东西,所以我自己设置了它们。 - 还要根据 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 -j
on a mac that never installed the beta you have os names like com.apple.CoreSimulator.SimRuntime.iOS-12-1
and iOS 12.1
.
我注意到,当您xcrun simctl list -j
在从未安装过测试版的 Mac 上运行时,您的操作系统名称类似于com.apple.CoreSimulator.SimRuntime.iOS-12-1
和iOS 12.1
。
After installing the Xcode 10.2 I still see the com.apple.CoreSimulator.SimRuntime.iOS-12-1
but the iOS 12.1
one is gone. I'm assuming find.rb
used the the latter to find the os_name
and os_version
values.
This is why I set them myself.
安装 Xcode 10.2 后,我仍然看到,com.apple.CoreSimulator.SimRuntime.iOS-12-1
但那个iOS 12.1
已经不见了。我假设find.rb
使用后者来查找os_name
和os_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:
通过以下步骤解决了它:
- In the Finder Menu select
Go/Go to Folder...
- Paste in
/usr/local/lib/ruby/gems
- Navigate to
{your gem version}/gems/fourflusher-{version}/lib/fourflusher/
- Open Terminal
- Type in
cd
(cd and a space) - Drag and drop the
fourflusher
folder (the one that has thefind.rb
file) - Type in
sudo vi find.rb
- Type in your password
- Type in
i
to be able to edit the file - Scroll all the way down in the file till you see
device['availability'] == '(available)' || device['isAvailable'] == 'YES'
- Append to this line the following:
|| device['isAvailable'] == true
- Now it should look like this:
- 在 Finder 菜单中选择
Go/Go to Folder...
- 粘贴
/usr/local/lib/ruby/gems
- 导航
{your gem version}/gems/fourflusher-{version}/lib/fourflusher/
- 打开终端
- 输入
cd
(cd 和一个空格) - 拖放
fourflusher
文件夹(包含find.rb
文件的文件夹) - 输入
sudo vi find.rb
- 输入您的密码
- 输入
i
即可编辑文件 - 在文件中一直向下滚动,直到看到
device['availability'] == '(available)' || device['isAvailable'] == 'YES'
- 将以下内容附加到此行:
|| device['isAvailable'] == true
- 现在它应该是这样的:
devices.map do |device|
if device['availability'] == '(available)' || device['isAvailable'] == 'YES' || device['isAvailable'] == true
Simulator.new(device, os_name, os_version)
end
end
- Type in
:wq
to save the file - Navigate to your .podspec file folder
- Run
pod lib lint
to lint it orpod trunk push
to push it
- 输入
:wq
以保存文件 - 导航到您的 .podspec 文件夹
- 运行
pod lib lint
以整理或pod trunk push
推动它
If you mistyped something or just want to totally start all over again you should uninstall and install fourflusher
like 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 CocoaPods
with 1.7.1
, then I did update to 1.7.2
and the problem gone
我正在使用CocoaPods
with 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 --version
show 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.podspec
and 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.app
is 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 操作)。