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

Unity Cloud Build and iOS - no events registers #102

Closed
oosmoxiecode opened this issue Aug 17, 2017 · 5 comments
Closed

Unity Cloud Build and iOS - no events registers #102

oosmoxiecode opened this issue Aug 17, 2017 · 5 comments

Comments

@oosmoxiecode
Copy link

Hi,

I did a test implementation of firebase analytics in my unity project. I followed the instructions here: https://firebase.google.com/docs/analytics/unity/start

Android seems to be working fine, getting events and can see users in the "streamview".

For iOS I use Unity's Cloud Build(adhoc), it seems to compile/build fine, but when testing I get no events and can't see any users.

Is it supposed to work "out of the box" with Cloud Build or do I need to do something else as well? Like add some pre-export method, some argument to xcode or similar?
Anyone got it to work together with Cloud Build? Any help would be much appreciated!

Thanks!

@stewartmiles
Copy link
Contributor

This has the same root cause as #101 so I'll close as a dupe .

As a workaround you'll need to add the additional preprocessor symbols / macros PB_FIELD_32BIT=1 and PB_NO_PACKED_STRUCTS=1 to your Xcode project from an editor plugin for Unity Cloud Build using the XcodeApi. You can see an example here https://github.com/googlesamples/unity-jar-resolver/blob/master/source/IOSResolver/src/IOSResolver.cs#L1236 as part of an asset preprocessor you'll need to add the flags PB_FIELD_32BIT=1 and PB_NO_PACKED_STRUCTS=1 to OTHER_CFLAGS.

@oosmoxiecode
Copy link
Author

Thanks for your answer and for clarifying!

Not sure I completely understand though, I´m not really familiar with xcode or how it works.
Would I do something like this then?

[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget buildTarget, string path) {
	if (buildTarget == BuildTarget.iOS) {
		string projPath = path   "/Unity-iPhone.xcodeproj/project.pbxproj";

		PBXProject proj = new PBXProject();
		proj.ReadFromString(File.ReadAllText(projPath));
		string target = proj.TargetGuidByName("Unity-iPhone");

		proj.AddBuildProperty(target, "OTHER_CFLAGS", "$(inherited)");
		proj.AddBuildProperty(target, "PB_FIELD_32BIT", "1");
		proj.AddBuildProperty(target, "PB_NO_PACKED_STRUCTS", "1");

		File.WriteAllText(projPath, proj.WriteToString());
	}
}

Or you said "add the flags to OTHER_CFLAGS", how do you do that?
Thanks!

@stewartmiles
Copy link
Contributor

I think it's

[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget buildTarget, string path) {
if (buildTarget == BuildTarget.iOS) {
string projPath = path "/Unity-iPhone.xcodeproj/project.pbxproj";

	PBXProject proj = new PBXProject();
	proj.ReadFromString(File.ReadAllText(projPath));
	string target = proj.TargetGuidByName("Unity-iPhone");
	proj.AddBuildProperty(target, "OTHER_CFLAGS", "PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 $(inherited)");
	File.WriteAllText(projPath, proj.WriteToString());
}

}

In Xcode you should end up with the following settings:
screen shot 2017-08-17 at 2 51 05 pm

@stewartmiles
Copy link
Contributor

Ok I have a temporary patch you can drop into your project. Replace the existing IOSResolver.dll under PlayServicesResolver/Editor with the attached file and regenerate your Xcode project.

IOSResolver.dll.zip

@oosmoxiecode
Copy link
Author

Yes, that seemed to work fine now!

Thanks a million, @stewartmiles, much appreciated!

@firebase firebase locked and limited conversation to collaborators Oct 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants