Xcodeapi for adding Sticker extensions

Hello all,

My company would like to add stickers and an iMessage app extension to our Unity3D game. Since we use automated build processes several times a day to build to iOS, we are constantly generating a new .xproj file for XCode, and need to make any changes to the project either through Unity3D directly, or in post-process build.

Since Unity3D doesn’t currently support stickers, it seems what I need to do is add a new target to the project through code. There is a library in BitBucket:

https://bitbucket.org/Unity-Technologies/xcodeapi/src/

written by the Unity3D team, but not updated since October 2015 (14 months ago). Within it, the PBXProject class contains the internal function AddAppExtension() which is unreferenced.

(a) Does this function work? I haven’t seen any information in the forums about it within the last two years.

(b) Has anyone tried getting this to work with iMessage extensions?

(c) Do I have any alternatives?

Thank you,

Mike Scandizzo

@MichaelSc did you get anywhere with this? We want to add a sticker extension but like you it has to be fully automated as we’re always creating new Xcode projects.

I too am looking into this as we are looking to add a stickers extension and a keyboard extension to our app.

This is now possible with the latest stable version of Unity’s XCode manipulator at https://bitbucket.org/Unity-Technologies/xcodeapi

Once you’ve added the XCode API to your project (you have to fudge the namespaces as per the instructions) you can add a post build trigger that does something like the following:

PBXProject proj = new PBXProject();
proj.ReadFromFile(pathToPbxProjFile);

// Add stickers extension target
string appTargetGuid = proj.TargetGuidByName("Unity-iPhone");
string stickersTargetGuid = proj.AddAppExtension(appTargetGuid, bundleId + "." + bundleIdSuffix, stickersInfoPlistPath);

// Copy assets
CopyRecursively(pathToStickersXcassets, stickersDestinationPath);
proj.AddFileToBuild(stickersTargetGuid, proj.AddFolderReference(stickersDestinationPath, "Stickers.xcassets"));

There’s a bit more you have to do to get sign the app extension with its own provisioning profile as well but it’s mostly possible with the current version of the XCode project manipulator.

It’s worth noting that while a stickers extension appears to work fine I am having trouble getting iMessage app extensions in general to open once they are built with the Unity app.

2 Likes

Guys,

I added a step by step process to be able to add stickers to your Unity3d game which is pretty straight forward.

Find the steps here and let me know if you have any questions.

http://dilmergames.com/blog/2017/04/15/unity3d-creating-stickers-your-ios-unity-game/

2 Likes

You can use this plugin from git-hub for implementing Sticker extensions. It works great for me. But I have a problem with Cloud build currently.

https://github.com/agens-no/iMessageStickerUnity

2 Likes

Hey thanks so much for doing this! you RoCk!

:slight_smile: I am glad it helped!

This is not an acceptable method for this thread, here we are looking for a code solution.

Is there any more info on this? I’m looking for an automated way to inject a sticker pack in our Unity-Iphone project.

Check this link for info http://dilmergames.com/blog/2017/04/15/unity3d-creating-stickers-your-ios-unity-game/

This is exactly the same link @dilmerval already provided and only tells us how to add a sticker pack manually. This thread is about adding it via code in an automated way.