About using Unity to export the XCode project with the Admob plug-in on the Windows side, and then package it on the Mac side

Recently, the company needs to put a previous Android app on the Apple Store, so it needs to study the Mac outsourcing process.
However, due to some reasons, it is not possible to directly export the package through Unity on the Mac, so the alternative that comes to mind is to export the XCode project from Windows first, then synchronize it to the Mac side through SVN, and then export the package.

Use the software as follows:

  • TortoiseSVN (SVN on Windows)
  • Cornerstone (SVN on Mac)

When synchronizing via SVN, you need to be careful whether there are files that have not been uploaded. At least the default settings of TortoiseSVN on my computer will ignore .athe files with the suffix name, resulting in the error that the total package dll is lost when the XCode project is packaged at the beginning. After modifying the settings, it will be normal.


Due to the difference between the version of the package on the Mac side and the Android side, the previous advertising-related logic needs to be rewritten. Therefore, all advertising plug-ins were deleted when packaging for the first time, and the whole process was relatively smooth.
The basic packaging process can refer to the content in this article .

However, the problem occurred after re-adding the ad plugin.
According to Admob official documentation, you need to .xcworkspaceopen the XCode project with a file extension called to compile successfully. However, there is no such file in the package exported by Windows, only a .xcodeprojfile with a suffix name. If you do not use a plug-in such as Admob, you .xcodeprojcan use the file directly to export the package normally, but since you use other plug-ins, you can only Find a way to get this .xcworkspacefile.

1. The beginning of everything, install CocoaPods

To generate this .xcworkspacefile, CocoaPods (an application-level dependency manager) must be installed.
If you have already installed this thing in your Mac before, then congratulations, the biggest obstacle has been swept away.
It is best to link to the external network throughout the whole process, and ensure that the network is smooth. Because sometimes you will see some strange installation error logs, which may actually be caused by network reasons. I finally installed it successfully with sufficient bandwidth after everyone else in the company was off work.
The reason why this thing is the biggest obstacle is that if you want to install CocoaPods, you need to install the Ruby environment first. Although Mac has a built-in Ruby, at least I tried a few times and failed, so in order to install the new version of Ruby, you must first install it. Go install an RVM (ruby version manager).
And it is very likely that you will need to use VIM-related operations to edit the file during the whole process. As a novice, just looking up these materials is quite a headache.
After installing CocoaPods, you can proceed to the next step.

2. Modify Podfile

The XCode project exported from the Windows side should contain a Podfile. If not, create one yourself. The content is roughly as follows:

source 'https://github.com/CocoaPods/Specs'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'Unity-iPhone' do
  pod 'Google-Mobile-Ads-SDK', '~>9.0'
end
use_frameworks!

Among them pod 'Google-Mobile-Ads-SDK', '~>9.0'is the dependency on admb sdk.
After confirming the Podfile, we need to enter the directory where the file is located (that is, the XCode project root directory of the current project) through the terminal, and then execute the following command:

pod install

At this time, an error may be reported when the program finishes running, which probably means that it is related to the version that the admob depends on. The solution is to remove '~>9.0'.
The modified dependency becomes pod 'Google-Mobile-Ads-SDK', just re-execute at this time , and after the program finishes running, a file with the suffix name pod installwill be generated in the root directory of the current XCode project ..xcworkspace


New problem when packaging MapFileParse.sh: Permission denied

For the solution, refer to this official feedback log .
The original text is as follows:

RESOLUTION NOTE (FIX VERSION 2021.2):
MapFileParser will be removed from 2021.1+ version
For earlier versions:
By default SMB configuration on Mac device does not allow to set an executable flag for security reasons.
One way to work around this is to make Xcode to set it for you.
Open generated Xcode project go to UnityFramework target / Build Phases / Run Script
at line 1 add:
chmod +x "$PROJECT_DIR/MapFileParser.sh"
line 2 of what it was on line 1:
"$PROJECT_DIR/MapFileParser.sh"
you can do it:

  • manually
  • with BuildPostProcessor via PBXProject API
  • or if you want to make this change for all iOS/tvOS generated projects change Unity-iPhone.xcodeproj in your Unity Editor installation for iOS/tvOS platform support modules Trampoline folder

p.s. In order to build directly to Mac shared folder you can Map Network Drive on windows and use it as target to Generate Xcode project.

It probably means that this thing is about to be eliminated in the new version, so you need to manually configure it, and add the following configuration in Build Phases -> Run Script:

chmod +x "$PROJECT_DIR/MapFileParser.sh"

Then you can pass it smoothly.


XCode packaging virtual machine Bug: no known instance method for selector 'presentDrawable:afterMinimumDuration

When viewing the official Unity website, the relevant feedback is as follows:

we are aware about the issues when building/running on xcode beta simulator. No ETA for now for a complete fix
Note: The issuer's Unity version is 2019.4 LTS

In other words, this is an unfixed bug in the Unity 2019 version.
Feasible solutions given by netizens below:
First find the location of the bug.

Change error line

[UnityCurrentMTLCommandBuffer() presentDrawable: surface->drawable afterMinimumDuration: 1.0 / targetFPS]; // Error is here

to

[UnityCurrentMTLCommandBuffer() presentDrawable: surface->drawable];

Guess you like

Origin blog.csdn.net/EverNess010/article/details/123679211