0
votes

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;
}
- (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 
2
This warning "City may not respond to -setImage:" want tell that your City object doesn't implement this method, so your issue must be there.Yannick Loriot
What type of object is c? Does it extend any native classes? Also your source code is incomplete/irrelevantpheelicks

2 Answers

0
votes

use this

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

0
votes

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

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