iphone - How to set Parser Delegate to Self in ARC environment? -
hey have used parsers in past never in arc environment. when try , set parser self gives me error message , doesn't parse data. know problem , how solve it?
here warning when try set parser delegate self:
semantic issue: sending 'charitycontroller *const __strong' parameter of incompatible type 'id<nsxmlparserdelegate>'
here code:
- (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data { if (connection == theconnection) { // data object. //nslog(@"data server is: %@",data); nsstring *test = [[nsstring alloc]initwithdata:data encoding:nsstringencodingconversionallowlossy]; nslog(@"data server is: %@",test); parser = [[nsxmlparser alloc] initwithdata: data]; [parser setdelegate:self]; [parser parse]; } } - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname attributes:(nsdictionary *)attributedict { if ([elementname isequaltostring:@"root"]) { currentstringvalue = nil; nslog(@"i inside parser @ root!."); return; }
did use protocol name in interface definition let compiler know conform particular protocol? such as:
@interface charityclass : nsobject <nsxmlparserdelegate>
Comments
Post a Comment