Sabarish
Sabarish

Reputation: 1184

ARC Error while using RaptureXML

I tried to use RaptureXML in my application as i came to know its easy to implement for parsing. Am trying to parse the remote XML file and get the images from it and view it as UIImageView. When i tried to call my remote XML file i got a warning and two errors as below,

The ViewController i used as show below,

- (void)viewDidLoad
  {
   [super viewDidLoad];
    RXMLElement *rootXML = [RXMLElement elementFromURL:[NSURL URLWithString:@"http://myxml.com/Sample.xml"]];
    RXMLElement *rxmlProducts = [rootXML child:@"Products"]; 
    NSArray *myarray = [rxmlPlayers children:@"Main"];
    UIImage *currentImage = [myarray objectAtIndex:0];
    customimage.image = currentImage;
  }

My Remote XML file looks like this,

<Products>
  <Main id="1">
    <name>Main</name>
    <mainimage id="1">http://myimage.com/images/first.png</mainimage>
    <mainimage id="2">http://myimage.com/images/second.png</mainimage>
  </Main>
  <Category id="1">
    <name>category1</name>
    <categoryimage id="2">http://myimage.com/images/img1.png</categoryimage>
  </Category>
  <Category id="2">
    <name>category2</name>
    <categoryimage id="2">http://myimage.com/images/img2.png</categoryimage>
    <subcategoryimage id="1">http://myimage.com/images/img5.png</subcategoryimage>
    <subcategoryimage id="2">http://myimage.com/images/img4.png</subcategoryimage>
  </Category>
</Products>

Can anyone tell me how to solve this error and how to parse the above Remote XML file using RaptureXML.

Upvotes: 0

Views: 321

Answers (2)

Sabarish
Sabarish

Reputation: 1184

Finally i solved the problem of ARC error by this below way,as suggested by the RaptureXML GitHub.

For ARC problem

Since this is a linker error

  • Go to project settings, select your current build target, and hit the "Build Phases" tab. Under "Compile sources.
  • Check whether RXMLElement.m is on that list, if not add the file in list. Now the ARC error will gets solved by linker.

For 'elementFromURL:' is deprecated Problem

  • They don't recommend using elementURL: anymore. You can get away with it, but it leaves you unable to customize the network call as some people want (timeouts, etc.). They recommend using your favorite network library to get the XML data and then piping that into RaptureXML.

Upvotes: 2

trojanfoe
trojanfoe

Reputation: 122391

OK there are 2 issues:

1) The author of RaptureXML has deprecated the elementFromURL method in this commit with the following comment:

It's recommended that you take care of the network operations yourself and let RaptureXML take care of the XML

2) It looks like you aren't using a (static?) library that has been compiled with support for the iPhone Simulator (architecture i386). To solve that you'll need to re-compile yourself, including the support or find one online that has this support already.

Upvotes: 0

Related Questions