Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cocoapods can't find simulators, pod repo push fails

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.

like image 608
Dan Morrow Avatar asked Oct 10 '18 14:10

Dan Morrow


4 Answers

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
like image 143
Hitendra Solanki Avatar answered Oct 10 '22 03:10

Hitendra Solanki


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.

like image 44
Pavlo Boiko Avatar answered Oct 10 '22 01:10

Pavlo Boiko


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!

like image 14
Richard Chirino Avatar answered Oct 10 '22 01:10

Richard Chirino


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

like image 6
Rebeloper Avatar answered Oct 10 '22 01:10

Rebeloper