question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do you define the target for Specific Build Settings or Adding Frameworks?

See original GitHub issue

I’ve made an App Extension with the addTarget function but even though I have the target defined like so :

// (some global paths deliberately left out but they all point correctly)
    var extFiles = [
        'NotificationService.h',
        'NotificationService.m',
        `${extName}-Info.plist`,
        'appgroupconfig.json',
        'PushExtension.entitlements',
    ];

        const proj = xcode.project(projPath);
        proj.parseSync();

        // Copy in the extension files
        fs.mkdirSync(`${iosPath}${extName}`);
        extFiles.forEach(function (extFile) {
            let targetFile = `${iosPath}${extName}/${extFile}`;
            fs.createReadStream(`${sourceDir}${extFile}`)
                .pipe(fs.createWriteStream(targetFile));
        });
        
        // Add a target for the extension
        let extTarget = proj.addTarget(extName, 'app_extension');

I cannot seem to define any buildProperties for it specifically. For example, the function

pbxProject.prototype.updateBuildProperty = function(prop, value, build)

takes in the property key the value and the build but this will only update the main project and not any of the targets defined.

The target parameter in the addFramework function doesn’t appear to work either. When digging into the pbxfile that it creates to addToFrameworkSearchPaths the target is not passed or accessed in the constructor. The following code doesn’t add the Framework to the target:

var opt = {target: extTarget.uuid, embed: true, customFramework: true, sign: true}
proj.addFramework(`${custom_framework_path}`, opt);

Can somebody please point me to the right direction here? I don’t know what I’m doing wrong.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
adam-govancommented, Oct 10, 2019

not a dumb question at all! 😄 I started in the same place that #47 was working on, automating a service extension (specifically for push in my case), but I found when adding a Custom Framework to the extension that it wasn’t adding to the correct target. It wasn’t exactly what #47 was covering so I decided to make my own issue and detail that exactly.

I hope that’s ok. I can close if you don’t think it’s required

1reaction
brodybitscommented, Sep 27, 2019

My apologies for the lack of response. Maintainers are completely overloaded. A PR with test coverage would be much appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing the build phases of a target - Apple Developer
To view the build phases for a target, select the target and navigate to the Build Phases tab, as shown in the following...
Read more >
Targeted .NET Frameworks - Visual Studio (Windows)
NET Framework that you want your project to target so the application can only use functionality that's available in the specified version.
Read more >
Using Xcode Targets
Under the "Build Settings" panel of a target you can expand each setting to select a different option per configuration. Commonly they are...
Read more >
target overrides the FRAMEWORK_SEARCH_PATHS build ...
From the Project Navigator on the left side, select your project. · On the center screen, go to Build Settings · Add a...
Read more >
Deep dive — Xcode Build Settings - Medium
With Xcode build settings we can control the build phases in order to generate a product i.e application or custom frameworks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found