43

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.

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

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

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

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.

Thanks for any help/advice.

6
  • XCode/Preferences/Locations/Command Line Tools; Check that you have the correct one selected. Also check that you have simulators?
    – Larme
    Commented Oct 10, 2018 at 14:02
  • There's only one choice for command-line tools (10A254a), and if I bring up "Devices and Simulators" a see a whole ton. Also, I can run on the sim.
    – Dan Morrow
    Commented Oct 10, 2018 at 14:12
  • 2
    @Ankur, it is Cocoapods issue - github.com/CocoaPods/fourflusher/commit/…. RP that fix it already merged. Commented Oct 12, 2018 at 13:25
  • 2
    After installing Xcode 11, pod lib lint is broken again because of fourflusher - The "availability" key from xcrun simctl list -j is now a boolean "isAvailable" Commented Jun 3, 2019 at 23:23
  • 6
    To address this issue after installing Xcode 11, follow @PavloBoiko's answer below and replace device['availability'] == '(available)' || device['isAvailable'] == 'YES' with device['availability'] == '(available)' || device['isAvailable'] == 'YES' || device['isAvailable'] == true
    – JoGoFo
    Commented Jun 4, 2019 at 5:08

9 Answers 9

62

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

  1. sudo gem update cocoapods

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

  1. sudo gem uninstall fourflusher
  2. sudo gem install fourflusher
  3. sudo gem update cocoapods
7
  • 6
    Simply updating cocoapods to 1.6.0 or newer should be enough for Xcode 10.2 compatibility.
    – Cœur
    Commented Mar 20, 2019 at 12:50
  • 1
    This worked fine for Xcode 12.1 and cocoapods 1.6.1 and also XCode 12.2 installed.
    – Nick N
    Commented Apr 10, 2019 at 21:20
  • 1
    @NickN Do you mean to say XCode 10.2? you comment [This worked fine for Xcode 12.1 and cocoapods 1.6.1 and also XCode 12.2 installed.] Commented Apr 12, 2019 at 6:50
  • 3
    This worked for me as well and it should be accepted solution.
    – Pat
    Commented Apr 29, 2019 at 8:48
  • 1
    Reinstalling fourflusher works for me, it seems updating cocoapods is not required.
    – Míng
    Commented Aug 9, 2019 at 4:06
25

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.

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

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 oneios simulator 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.

  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.podspec should work.

If something does not work, please reply.

or

The above solutions will work on a specific Xcode version. To get the solution that works with any Xcode version use the following. Rather than editing the file, you can copy entire content from https://github.com/CocoaPods/fourflusher/blob/master/lib/fourflusher/find.rb and replace.

7
  • 5
    I would like to add someone's ruby/gems directory may be different. Use gem env to list your GEM PATHS. Mine was in /Library/Ruby/Gems/2.3.0 for example. This has also been patch in fourflusher: github.com/CocoaPods/fourflusher/pull/11
    – Ivan Lesko
    Commented Oct 19, 2018 at 0:22
  • 2
    gem which fourflusher to find fourflusher.
    – Cœur
    Commented Oct 19, 2018 at 10:31
  • Note: fourflusher-2.1.0 fixes this issue, so you can solve the problem by updating to that version.
    – Caleb
    Commented Dec 12, 2018 at 18:17
  • 4
    Xcode 10.1 and Xcode 10.2 compatibility were fixed in cocoapods 1.6.0 and newer.
    – Cœur
    Commented Mar 20, 2019 at 12:52
  • 9
    To address this issue after installing Xcode 11 replace device['availability'] == '(available)' || device['isAvailable'] == 'YES' with device['availability'] == '(available)' || device['isAvailable'] == 'YES' || device['isAvailable'] == true - source from @JoGoFo . Thanks
    – Rebeloper
    Commented Jun 5, 2019 at 9:06
14

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:

  1. Find the find.rb of fourflusher, you can tell by the location on the error after running the pod trunk push command. 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_name and os_version are set. If you look in the comment above it expects to split # Sample string: iOS 9.3 into iOS and 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

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.

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.

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.

Hope this helps other people, good luck!

3
  • 1
    Submitted an issue on the CocoaPods repo. Commented Jan 26, 2019 at 19:01
  • Mine was the same issue. After installing XCode 10.2 beta and removing this beta version, because I upgraded XCode 9.3 to XCode 10.1.
    – Jiang Wang
    Commented Feb 19, 2019 at 1:43
  • Xcode 10.2 compatibility was fixed in cocoapods 1.6.0 and newer.
    – Cœur
    Commented Mar 20, 2019 at 12:51
6

After installing Xcode11-beta had the same issue:

- 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 fourflusher folder (the one that has the find.rb file)
  7. Type in sudo vi find.rb
  8. Type in your password
  9. Type in i to 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:
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 :wq to save the file
  2. Navigate to your .podspec file folder
  3. Run pod lib lint to lint it or pod trunk push to push it

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:

Uninstall: sudo gem uninstall fourflusher

Install: sudo gem install fourflusher

4

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

1
  • Way easier answer than the other ones, and it works perfectly, thanks!
    – JoniVR
    Commented Jun 21, 2019 at 14:13
2

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

sudo gem install cocoapods 
1

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

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

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

0

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.

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.

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

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).

0

Just adding this for completeness but I received this error and determined that I was getting it because of the fact that I had multiple versions of Xcode installed AND because Preferences > Locations > Command Line Tools was set to a version of Xcode that didn't have the needed simulator installed.

Switched Command Line Tools to the current version that DID have the missing simulator and all was well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.