Embed XMP data to PNG with Objective-C

I need to embed a custom XMP file to a PNG in a iOS app.
Until now, what I was able to do is to compile the Adobe XMP toolkit, that generated an Xcode project, then I compiled the project correctly.

From there I don’t know how to use the library in my Xcode project and how to use it. I’ve found very little info about this on the Internet.

  • Symbol not found when using template defined in a library
  • Anyone who did the same wishing to help?

    2 Solutions Collect From Internet About “Embed XMP data to PNG with Objective-C”

    If you downloaded the Adobe XMP Toolkit SDK, you can find an example of writing the XMP metadata in “ModifyingXMP.cpp” and an example of reading the already XMP-written file in “ReadingXMP.cpp” file. Note that I am using XMP-Toolkit-SDK-CC201607 version.

    You need static files and header files to be included in your iOS project later. Read the instructions carefully on how to generate them, specifically on what kind of archs you need. In my case, I generated [arm64, armv7, armv7s] and [x86_64] separately and then lipo them together later.

    Try and modify “ModifyingXMP.cpp” according to what you need. Include these source codes into your iOS app project as Objective-C++ (with .mm extension). Don’t forget to include the header file, libXMPCoreStatic.a file, libXMPFilesStatic.a file, make a bridging header, and configure your project to import external static libs. If you don’t understand what I am talking about, check these links:

    https://forums.adobe.com/thread/1360320

    How can I use an .a static library in swift?

    Here is what it looks like in my demo project:
    enter image description here

    My implementation on XmpWriter.h:

    #import <Foundation/Foundation.h>
    
    @interface XmpWriter : NSObject
    
    +(BOOL) writeXmp:(const char *) imageUrl Param1:(const char *) Param1 Param2:(float) param2 Param3:(float) Param3;
    +(BOOL) readXmp:(const char *) imageUrl;
    
    @end
    

    In my XmpWriter.mm file, I modify the createXMPFromRDF() to accept my parameters like:

    SXMPMeta createXMPFromRDF(const char *Param1, float Param2, float Param3)
    

    I hope you can get closer to what you want to achieve from here.

    The iOS build support shown in the XMP specification PDF shows this was added in July 2016, but that indicates support for Xcode 7.2.1, so it’s possible this library just won’t work in Xcode 9, as it’s not clear it’s been updated anytime recently.

    As far as a more concrete method of using the XMP sample project you generated, from the documentation linked above you should be able to find a ReadingXMP demo, which should be platform specific (so helpful for you in Xcode). The doc states that this demo will

    Demonstrates the basic use of the XMPFiles and XMPCore components, obtaining read-only XMP from a file and examining it through the XMP object.

    You’ll need to compile and build them in command line, from <xmpsdk>/samples/source, and will be written to <xmpsdk>/samples/target/. I think filename specified will be the Xcode project the SDK generated, but as you’ve noticed there’s not much documentation there.

    I honestly haven’t used it myself, but I’m hoping this will help a little :).