Is it possible to use a cocoapod with a UE4 project?

I’m trying to finalize the plugin I’m working on and have my iOS code in place, but part of my code depends on the cocoapod framework we have. Unfortunately, it seems cocoapod install requires a .xcodeproject, but UE4 generates a .xcodeworkspace in the main project folder. While there are UE4.xcodeproj and MyProject.xcodeproject under /Intermediate/ProjectFiles/, pointing the Podfile to either of those fails due to their data structure, which may be out of the norm with Unreal’s unique way of building projects.

Anyone ever tried using a cocoapod with a UE4 project before that could give some insight on how to do it?

I don’t know if I can be all of that helpful, especially on iOS. What I typically do on Windows is get the source of whatever library I am trying to use within Unreal in C++. So if cocoapod has a C++ framework they share which should work with VS 2012 and above, you can probably just grab this. What you have to do next is create a plugin using sample plugin Unreal’s source in C++. Next, once you’ve also added cocoapad framework to your Unreal Plugin code base you want to began the process of integrating the two code bases to began communication between objects within Unreal, and your cocoapad. There is input class that has everything already setup, you just need to pass input to a generic interface from the base class you inherit.

Hope that helps, I can link to other things if you want specifics.

Unfortunately that doesn’t help me at all.

However, I went through my linking Objective-C++ code and had to adapt a lot of things that were Swift/Obj-C specific that would properly adapt the Obj-C/Swift code with the Objective-C++ build process.

I can get the code to compile now, but the project will not build because it cannot find the framework.

Specifically, this is where I’m at:

This is with PublicAdditionalFrameworks.Add(); for the .framework in my module’s Build.cs. As can be seen from the log output, it does in fact parse the .framework for our SDK, unzips to intermediate folder, but then says it can’t find the framework. I’ve got no clue where to go from here.

Edit: In regards to my first post, what I had to do was edit the .xcodeproj files and comment out a few lines from the cocoapod error xcodeproj doesn’t know about the following attributes: {passBuildSettingsInEnvironment=>“1”} for the PBXNativeTarget. So I found the PBXNativeTarget sections in the xcodeproj and commented out the lines containing passBuildSettingsInEnvironment=1 in those target descriptors.

I’m not sure if that’s why I’m having the issue where the framework isn’t being seen in the build.

Have you tried adding the framework location(s) to [FONT=Courier New]PROJECTNAME.Target.cs file?
LinkEnvironmentConfiguration has a specific property for defining frameworks for ios/mac.


/// <summary>
/// The iOS/Mac frameworks to link in
/// </summary>
public List<string> Frameworks = new List<string>();
public List<string> WeakFrameworks = new List<string>();

Oh by the way… objc compiles without automatic reference counting for unreal engine.
You might need to specify [FONT=Courier New]-fobjc-arc for compiler arguments as well.

You can also download the source, alter UnrealBuildTool’s [FONT=Courier New]IOSToolChain.cs for your liking…

I didn’t know that was a requirement to add into Target.cs, which I have never modified before outside of module names. It doesn’t know what the name Frameworks is if I try to add in the same way.

Is there any working example of any kind that demonstrates implementing a framework? I have yet to see one, or any actual documentation of any kind for this.

Aid you have any luck with this? We’ve been bashing our heads against the wall for days trying to solve this issue. Hard to believe mobile games are actually written using this framework :frowning:

So, the answer to this is that you cannot use dynamic frameworks on iOS.