开发者

iPhone XML Parser - [c setImage:[attributeDict objectForKey:@"img"]]; WARNING

开发者 https://www.devze.com 2022-12-21 09:40 出处:网络
Hi I am having issues with the following and it crashes the iPhone simulator, while the script has no errors it did bring up one warning in this script.

Hi I am having issues with the following and it crashes the iPhone simulator, while the script has no errors it did bring up one warning in this script.

[c setImage:[attributeDict objectForKey:@"img"]];

The warning is

City may not respond to -setImage:

I am not sure what I have done wrong here is the fill source code.

#import "LocationsParser.h"
@implementation LocationsParser
@synthesize managedObjectContext;
-(id) initWithContext: (NSManagedObjectContext *) managedObjContext
{
    self = [super init];
    [self setManagedObjectContext:managedObjContext];
    return self;
开发者_StackOverflow社区}
- (void)parseXMLFileAtURL:(NSURL *)URL parseError:(NSError **)error
{
    // /Applications/MyExample.app/MyFile.xml
    NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:URL];
    // Set self as the delegate of the parser so that it will receive the parser delegate methods callbacks.
    [parser setDelegate:self];
    // Depending on the XML document you're parsing, you may want to enable these features of NSXMLParser.
    [parser setShouldProcessNamespaces:NO];
    [parser setShouldReportNamespacePrefixes:NO];
    [parser setShouldResolveExternalEntities:NO];
    [parser parse];

    NSError *parseError = [parser parserError];
    if (parseError && error) {
        *error = parseError;
    }

    [parser release];
}

-(void) emptyDataContext
{
    // Get all counties, It's the top level object and the reference cascade deletion downward
    NSMutableArray* mutableFetchResults = [CoreDataHelper getObjectsFromContext:@"County" :@"Name" :NO :managedObjectContext];

    // Delete all Counties
    for (int i = 0; i 


use this

[c setImage:(id)[attributeDict objectForKey:@"img"]];


c - what is it? E.g., if it is supposed to be UIImageView, you can do so:

[(UIImageView *)c setImage:[attributeDict objectForKey:@"img"]];
0

精彩评论

暂无评论...
验证码 换一张
取 消