Tag Archives: cocoapods

[Solved] New MAC Unity Develop Error: error installing cocoapods

The new MAC system is 11.4, and the installed Xcode version is 13.2.1
after opening a unity project and switching to IOS platform, cocoapods is installed in the background, but an error is reported indicating that the installation fails:

ERROR: Error installing cocoapods:
       ERROR: Failed to build gem native extension.
   current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220311-4106-wxounc.rb extconf.rb
   mkmf.rb can't find header files for ruby at /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development environment,ruby-dev or ruby-devel for example.

According to the error prompt and query from the network, it should be that a new Ruby Version needs to be installed, and the ruby provided by the system cannot be used
installing Ruby requires RVM, and installing RVM requires homebrew

Install homebrew

Use the command /usr/bin/Ruby - e" $(curl - fssl) is not used here https://raw.githubusercontent.com/Homebrew/install/master/install )"

After installation, execute brew update update.

Then execute brew -vto see the installed version

Install RVM

Install RVM curl -L https://get.rvm.io | bash -s stable

reload RVM environment source ~/.rvm/scripts/rvm

View RVM version RVM -v

Install Ruby

Check the known version of ruby RVM list known

check the installed version of ruby RVM list

Install a ruby version. I chose 2.6.5 RVM install 2.6.5

After installation, check the Ruby Version Ruby -v. If it is not the version just downloaded, I need to use the command to cut the version

Install cocoapods

After the above installation, execute sudo gem install cocoapods -n/usr/local/bin to install cocoapods
after the installation, execute pod --version to view the version of cocoapods

Here, for unit packaging, cocoapods are not completely installed. You need to continue to follow the following steps.

Command + Shift + G, open to the folderpop-up window, and enter ~/.cocoapods, after opening the cocoapods folder, delete all the contents under it, create a new repos folder, open the command line tool, and execute the following three commands in turn

1) cd ~/.cocoapods/repos
2) git clone --depth 1 https://github.com/CocoaPods/Specs.git master
3) pod repo update

In this way, the Xcode project exported by unity will have Xcworkspace file (in case of problems in cocoapods environment, the exported Xcode project only has .xcodeproj file, and there are many exceptions when using this file for packaging press conference), and then open the file with Xcode for subsequent publishing

Macos: How to Solve cocoapods Install Error

Executing “sudo gem install -n /usr/local/bin cocoapods” gave me an error: “Failed to build gem native extension”.
Followed the online method, confirmed the ruby version 2.6.3, and installed rvm also reported an error (443 error), in short, tried everything I could find on stackoverflow

The final solution: specify a lower version when installing cocoapods: sudo gem install cocoapods
sudo gem install cocoapods -v 1.8.4

Directly solved.

[Solved] Searching for inspections failed: undefined method `map‘ for nil:NilClass“

Recently, the new project of pod reported this error. My Mac M1, record it

[cocoapods error]: searching for inspections failed: undefined method ` map ‘for nil: nilclass “error

Solution: execute the following command line

sudo arch -x86_64 gem install ffi

Then pop install

M1 Computer: How to Solve pod update

Error Messages:

Solution:

Method 1: A simple and straightforward solution
Add arch -x86_64 in front of the pod command
e.g. arch -x86_64 pod update

Method 2: reinstall cocoaPods

Answering my own question. I fixed the ffi issue by uninstalling my faulty Ruby version and CocoaPods, then I used the -x86_64 arch to reinstall ffi and CocoaPods.
These are the steps I did to get back to a working state (and to apply the M1 workarounds for ffi):

Uninstall Ruby with: brew uninstall ruby –force
Uninstall CocoaPods. At first, try to list all CocoaPods versions / components with gem list –local | grep cocoapods. Then uninstall them one by one, in my case:
sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-downloader
etc.
As a next step I was able to reinstall ffi and then CocoaPods with:
sudo arch -x86_64 gem install ffi
sudo arch -x86_64 gem install cocoapods
Once done, I could run pod install as expected. Note that I had the Terminal open all the time in standard mode – no Rosetta required

RuntimeError – [Xcodeproj] Unknown object version.

After xcode13 is upgraded, if a new project is built, pod install will report an error, as shown in the figure:

Reason: This is because the local version of Xcode does not match the version of cocoapods. You need to update cocoapods
solution:

Refer to the solution provided on the Internet and input the command at the terminal  $ gem install cocoapods --pre  

Error will be reported:     You don’t have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

  Solution: input in the terminal     sudo gem install -n /usr/local/bin cocoapods –pre

It can be used normally in pod install

 

How to Solve Cocoapods Installation Failure

The scene appears

Recently, I replaced a 512 large hard disk and re installed MacOS 10.15. When installing cocoapods, the following error occurred

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20210324-1667-1wwdce5.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
creating extconf.h
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
make "DESTDIR="
make: *** No rule to make target `"/Volumes/macOS', needed by `AbstractMemory.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.0/gem_make.out

Solution:

    1. it may be the problem of system version, which is not compatible with the latest version, so install the old version directly. I encountered the problem is 2021.07.06, the latest version is 1.10.1, find a 1.9.32020.05 release, should be compatible with 10.15
# Specify version to install
sudo gem install -n /usr/local/bin cocoapods -v 1.9.3
      1. use brew to install
brew install cocoapods

Not a PNG file.. solution

Let me show you what I did wrong

The reason for this error is that my image was in JPG format before, and then I changed the suffix name to PNG. It looks like you have changed it, but in fact you still haven’t changed it. The image is still in JPG format.
Solutions:
1. First change the image format to JPG format
(Why don’t you just drag the image to Photoshop, because you can’t do that at this time)

So, when we change the image format to JPG, we can drag it to PS
2. Drag the image into Photoshop and save it again. Make sure to change the format to PNG.

[!] Invalid `Podfile` file: syntax error, unexpected end-of-input, expecting keyword_end.

This article is to document some of the problems with pods
[!] Invalid `Podfile` file: syntax error, unexpected end-of-input, expecting keyword_end.
The solution, when editing here, is to add end
Platform: ios, ‘8.0’
target:’JDtest’ do
pod ‘Masonry’
end

[!] The dependency `Masonry` is not used in any concrete target.

Solution, in the edit here, add target, ⚠ ️ ‘JDtest’ after the target, as the project name, ‘project name’
Platform: ios, ‘8.0’
target:’JDtest’ do
pod ‘Masonry’
end