download,parse xml in background thread

Discussion in 'iOS Programming' started by mraheel, Jan 16, 2010.

  1. mraheel macrumors regular

    Joined:
    Apr 18, 2009
    #1
    Hey,

    I was trying to load XML in background, but its throwing these things in console. I am using TBXML library to load/parse a file from URL.
    ANd if i dont use that, theres a lag, the UI stucks up and until the file is downloaded and parsed, nothing happens. Reminded me of windows.


    Code:
    -(void)LoadinBack{
    	
    	[self performSelectorInBackground:@selector(GetData) withObject:nil];	
    }
    //GetData is the method that fills the array. -(void):GetData;

    Code:
    Stack: (0x305a2e6f 0x30504682 0x305172e5 0x3055d08b 0x76dc 0x2aeb 0x3050a79d 0x3050a338 0x906fc095 0x906fbf52)
    2010-01-16 23:10:42.254 APPx[1889:4103] *** _NSAutoreleaseNoPool(): Object 0xd897e0 of class NSCFData autoreleased with no pool in place - just leaking
    Stack: (0x305a2e6f 0x30504682 0x305172e5 0x3055d08b 0x76dc 0x2b1b 0x3050a79d 0x3050a338 0x906fc095 0x906fbf52)
    2010-01-16 23:10:42.254 APPx[1889:4103] *** _NSAutoreleaseNoPool(): Object 0xd301c0 of class NSCFString autoreleased with no pool in place - just leaking
    anyway way around this..
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Most likely if you create your own autorelease pool at the start of the background method and release it at the end that will go away but without the code we can't tell for sure.
     
  3. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #3
    You could also do a detached thread that would allow it to run in the background, however make sure you lock the variables used so the main thread does not release the variables before they are finished in the thread.
     

Share This Page