Search code examples
objective-ccordovacordova-pluginsconfig

Get access to config.xml from objective-c?


I would like to check installed plugins and versions of cordova project in native code(objective-c). I think that one of approach for make it possible is check config.xml but I stuck with it. Could please someone clarify is it possible or is there some other approach for checking plugins and versions?


Solution

  • There is a config.xml file in your app, but it's different from the root one, the plugin tags are converted to feature tags and they don't include the version, so what you want to do is not possible, unless you add some hook that copies the original config.xml to another folder inside your app and read that copy.

    To read the transformed config.xml with Objective-C:

    NSString* path = [[NSBundle mainBundle] pathForResource:@"config.xml" ofType:nil];
    NSURL* url = [NSURL fileURLWithPath:path];
    

    And then use the NSXMLParser class to parse it.