copenndthagen
copenndthagen

Reputation: 50722

iphone program warnings

I have some code added in viewWillAppear;

curr_rep_date = [tmpRptDt stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%d",tmpYrVal] withString:[NSString stringWithFormat:@"%d",(tmpCurrYearInt-2)]];

When I build, I get the following warning;

warning: incompatible Objective-C types assigning 'struct NSArray *', expected 'struct NSMutableArray * }

Also warning: assignment makes pointer from integer without a cast for:

replist_rptdt_dict = PerformXMLXPathQuery(xmlData, @"//XX/Period[@XX]");

Please let me know the reason. Thanks.

Upvotes: 1

Views: 504

Answers (1)

bbum
bbum

Reputation: 162712

replist_rptdt_dict = PerformXMLXPathQuery(xmlData, @"//XX/Period[@XX]");

First, the Objective-C standard is to use camel cased english names for variables. replist_rptdt_dict is confusing (it almost sounds like you have a list dictionary something what huh?).

warning: incompatible Objective-C types assigning 'struct NSArray *', expected 'struct NSMutableArray *' }

This will happen if you have:

- (NSArray *) foo;
...
{
    NSMutableArray *bar = [someObject foo];
}

That is, bar is a more specific type -- a subclass -- than foo's return value. The compiler is complaining because your code is quite likely going to crash if you send, say, removeObjectAtIndex: to what is quite likely an immutable array.

Upvotes: 1

Related Questions