IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

Issue in iOS after cross compile using XmlPull library

  • 1.  Issue in iOS after cross compile using XmlPull library

    Posted Thu January 10, 2013 09:17 PM

    Greetings,

    We’re working on an app, and the developer is including the xmlpull library to work with some XML data.

    In XCode, the XmlPullParserFactory.mm class shows a pair of Semantic issues with a specific line.

    In the original java it looks like this:

    final String name = classNames.substring(pos, cut);

    Class candidate = null;

    Object instance = null;

    try

    {

      candidate = Class.forName(name);
    
    // necessary because of J2ME .class issue
    
    instance = candidate.newInstance();
    

    }

    When converted to Objective C, the first line in the try block looks like:

    candidate = Class::forName(name);

    … and I get the following 2 issues with that line:

    •   Expected a class or namespace
      
    •   Reference to ‘Class’ is ambiguous
      

    I’ve done no native iOS development, so I don’t know where to start on this. Has anyone seen anything like this before, or have any insight they can share?

    Dave


    #mobile
    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 2.  RE: Issue in iOS after cross compile using XmlPull library

    Posted Fri January 11, 2013 09:28 AM

    Ambiguity sometimes happens where ObjectiveC names clash with Java ones.

    I would modify the java to have an import at the top of:

    import java.lang.Class;

    and then change any references to Class to be fully qualified e.g.

    java.lang.Class candidate = null;

            candidate = java.lang.Class.forName(name);
    

    etc…

    That way the compiler will not have a chance to get confused.

    Cheers,

    Matt


    #webMethods-General
    #mobile
    #Integration-Server-and-ESB
    #webMethods