Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ltomov opened this issue Jun 10, 2020 · 0 comments

Comments

@ltomov
Copy link

ltomov commented Jun 10, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant