开发者

Objective-C error... Cannot convert to pointer type (int)

I am attempting to use the TouchX开发者_开发知识库ML library and followed the example with the following code

for (CXMLElement node in nodes) {
            NSMutableDictionary *item = [[NSMutableDictionary alloc] init];
            int counter;
            for (counter = 0; counter < [node childCount]; counter++ ) {
                [item setObject:[[node childAtIndex:counter] stringValue] forKey:[[node childAtIndex:counter] name]];
            }

            [rst addObject:item];
            [item release];

        }

The compiler however is complaining about counter and throwing the following error for counter = 0 and both occurances in the setObject call.

Cannot convert to pointer type

Any help with my rusty C/ObjC would be appreciated


My bad, had nothing to do with counter, rather this...

for (CXMLElement node in nodes) {

node needs to be declared as a pointer like so...

for (CXMLElement *node in nodes) {
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜