How to add pods for iOS

Following the instructions on the Fuse Cocoapods repo and after looking at a few sample apps, I thought just adding:

[Require("Cocoapods.Podfile.Target", "pod 'MoEngage-iOS-SDK'")]

into any .uno file would translate into it being added to a project. But whatever pod I try never gets added to the generated .xcworkspace.

I can modify the Podfile after the build then do a pod update which works, but I don’t suspect this is what everyone else is doing.

What am I missing?

Hey @Jalakoo.

I think you need to add CocoaPods build flag in Fuse Studio, go to Preview -> Build flags -> Enable CocoaPods builds on iOs. From terminal you can do this by running fuse build -t=iOS -DCOCAPODS.

Hope this helps.

Hey Arturs, sadly no effect:

Downloading dependencies

[!] The Podfile does not contain any dependencies.

Here’s the .uno file I’m trying:

using Uno;
using Uno.UX;
using Uno.Collections;
using Uno.Compiler.ExportTargetInterop;
using Fuse;

namespace Fuse.MoEngage
{
    extern(!mobile)
    public class Core
    {
        static public void Init() { }
    }

    [Require("Cocoapods.Podfile.Target", "pod 'MoEngage-iOS-SDK'")]
    [Require("Source.Include", "Stripe.h")]
    extern(iOS)
    public class Core
    {

        [Foreign(Language.ObjC)]
        static public void Init()
        @{
            NSLog(@"MoEngage:Init")
        @}
    }

    extern(Android)
    public class Core
    {

        [Foreign(Language.Java)]
        static public void Init()
        @{
        @}
    }
}

Because I can’t even get a simple Foreign Code sample working, I’m wondering if I’m missing something in the .unoproj file? Didn’t think that was necessary, but I’ve tried the following options in the includes key:

"MoEngage.uno"
"MoEngage.uno:Bundle"
"MoEngage.uno:Source"
"MoEngage.uno:SourceFile"

Hey.

I tried Foreign Code example you mentioned, it works fine on the iOs device. What exactly is not working for you? Are there any errors you can share with us?

Move pod file require at the beginning, like this:

...
using Fuse;

[Require("Cocoapods.Podfile.Target", "pod 'MoEngage-iOS-SDK'")]
namespace Fuse.MoEngage {
...