Skip to content

The iOS Extras/PostprocessBuildPlayer_GA script is not adding the needed libraries #196

@ltomov

Description

@ltomov

For iOS there are a number of libraries that need to be added in the Xcode project.
The documentation says that you can use the script in iOS Extras/PostprocessBuildPlayer_GA to automate this process, but the script seems outdated and no longer works.

I managed to get it to work with a few tweaks (it needs python3 and the pbxproj module installed):

#!/usr/bin/python3

#Add required libraries to Xcode project during build for Google Analytics
from pbxproj.XcodeProject import *
from os import path, listdir
from shutil import copytree
import sys

frameworks = [
              'AdSupport.framework',
              'CoreData.framework',
              'SystemConfiguration.framework',
              'libz.tbd',
              'libsqlite3.tbd'
              ]

framework_dir = path.join(sys.argv[0],'..','..','Plugins','iOS')

pbx_file_path = sys.argv[1] + '/Unity-iPhone.xcodeproj/project.pbxproj'
pbx_object = XcodeProject.load(pbx_file_path)

pbx_object.add_framework_search_paths([path.abspath(framework_dir)])

for framework in frameworks:
    pbx_object.add_file('System/Library/' + framework, tree='SDKROOT', file_options= FileOptions(embed_framework=False))

pbx_object.save()

Furthermore it seems this script wasn't even getting executed after a build, perhaps Unity dropped that feature, so I'm now manually running it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions