2.iOS Resolver Settingsを開き、Cocoapods Integrationを「Xcode Project – Add Cocoapods to the Xcode project」にする。
3.Assetsフォルダ直下に「MyPlugin」というフォルダを作り、その中に「Editor」フォルダを作り、ファイル「MyPluginDependencies.xml」を作り、以下のように記述する。ただ、ここの記述は後でPodfileを書き換えるので、あまり意味がないかもしれない。
<dependencies>
<!-- Android dependencies are specified under the "androidPackages" element.
Each "androidPackage" element contains the attributes of an Android
dependency (e.g AAR, JAR reference). -->
<androidPackages>
<!-- Global set of repositories to search for packages.
These repos will be searched for all packages specified by
androidPackage. -->
<repositories>
<repository>https://repo.maven.apache.org/maven2</repository>
</repositories>
<!-- The "spec" attribute is *required* and provides the Maven package
specification.
Currently this only supports group:artifact:version_specification where
group:artifact:version_specification references a Maven package that
can be located in:
* Maven central.
* Google's Maven repo.
* Local Android SDK Maven repo.
Additional repositories can be added using the "repositories" element.
-->
<androidPackage spec="com.google.android.gms:play-services-games:9.8.0">
<!-- androidSdkPackageIds is optional and contains the set of Android
SDK package manager components (packages) this package requires.
If the package can't be found in any of the specified repositories,
the dependency resolver will attempt to install the set of Android
SDK packages specified here and then attempt resolution again.
-->
<androidSdkPackageIds>
<androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
</androidSdkPackageIds>
<!-- "repositories" are optional and contain the set of additional
repository URIs to search for this package. -->
<repositories>
<repository>https://maven.google.com</repository>
</repositories>
</androidPackage>
</androidPackages>
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
<iosPods>
<!-- Global set of sources to search for Cocoapods.
These sources will be searched for all Cocoapods specified by
iosPod. -->
<!-- <sources>-->
<!-- <source>https://cocoapods.mycompany.com/Specs</source>-->
<!-- </sources>-->
<!-- iosPod supports the following attributes:
* "name" (required)
Name of the Cocoapod.
* "path" (optional)
Path to the local Cocoapod.
NOTE: This is expanded to a local path when the Podfile is generated.
For example, if a Unity project has the root path "/my/game" and the
pod the path is "foo/bar", this will be will be expanded to
"/my/game/foo/bar" when the Podfile is generated.
* "version" (optional)
Cocoapod version specification for the named pod.
If this is not specified the latest version is used.
NOTE: This can't be used when "path" is set.
* "bitcodeEnabled" (optional)
Whether this Cocoapod requires bitcode to be enabled in Unity's
generated Xcode project. This is "true" by default.
* "minTargetSdk" (optional)
The minimum iOS SDK required by this Cocoapod.
* "addToAllTargets" (optional)
Whether to add this pod to all targets when multiple target is
supported. This is "false" by default.
* "configurations" (optional)
Podfile formatted list of configurations to include this pod in.
* "modular_headers" (optional)
Set to true to enable modular headers, false to disable.
* "source" (optional)
Source repo to fetch the pod from.
* "subspecs" (optional)
Subspecs to include for the pod.
-->
<iosPod name="Google-Mobile-Ads-SDK" version="~> 7.0" bitcodeEnabled="false" minTargetSdk="6.0">
<!-- Set of source URIs to search for this Cocoapod spec.
By default Cocoapods will attempt to fetch the pod specs from:
* $HOME/.cocoapods/repos
* https://github.com/CocoaPods/Specs
-->
<sources>
<source>https://github.com/CocoaPods/Specs</source>
</sources>
</iosPod>
</iosPods>
</dependencies>
4.Project SettingsのOther Settings内にあるIdentificationの部分のBundle IdentifierとSigning Team IDを入力する。
5.iOSのプラットフォームでビルドすると、Xcodeプロジェクトが生成されるが、そのフォルダ内に、「Podfile」が生成されているので、このファイル内の記述を以下のようにする。
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '11.0'
target 'UnityFramework' do
pod 'Google-Mobile-Ads-SDK', '~> 9.11'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static