• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: program termination after releasing self defined NSXMLParser class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: program termination after releasing self defined NSXMLParser class


  • Subject: Re: program termination after releasing self defined NSXMLParser class
  • From: Alexander Spohr <email@hidden>
  • Date: Fri, 16 Apr 2010 18:34:46 +0200

Am 16.04.2010 um 00:43 schrieb Dominic Dauer:

> With the purpose to test these simple class I just did the following in the controller class of one view:
>
> -(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
>
> 	XMLParser *parser = [[XMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://localhost/test/out.xml";]];
> 	[parser setDelegate:parser];
> 	[parser parse];
>
> 	[parser release];
>
> 	return NO;
> }
>
> -----------------------------------------------------------------
>
> Everything works fine until call the release method to the parser. In the simulator the app is terminating without any message in the log.
> I guess I do a fundamental mistake.
>
> Any ideas?

Yes. The docs state:
-parse
Starts the event-driven parsing operation.

That means that -parse does not block. It runs in the event loop.
So the parser starts running and wants to talk to its delegate. But too bad - you released it right after it started to work.

You have to retain it as long as the parsing takes. That is what the delegate is for.

	atze

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: program termination after releasing self defined NSXMLParser class
      • From: Fritz Anderson <email@hidden>
References: 
 >program termination after releasing self defined NSXMLParser class (From: Dominic Dauer <email@hidden>)

  • Prev by Date: Re: How to empty the Trash programmatically?
  • Next by Date: Re: Does XCode 3.2 Documentation Browser Stink?
  • Previous by thread: Re: program termination after releasing self defined NSXMLParser class
  • Next by thread: Re: program termination after releasing self defined NSXMLParser class
  • Index(es):
    • Date
    • Thread