Out of scope error while repeating NSMutableArray

Why do I get an "out of scope" error whenever I try to access the variable "url" in this loop?

for(NSString *url in self.winnerImageURLs) {
        [mediaItemString appendFormat:@"{\"type\":\"image\",\"src\":\"%@\",\"href\":\"%@\"},", url, url];
    }

The class of the element itself in "self.winnerImageURLs" NSMutableArray is returned as NSCFString, so I'm not sure what it is here.

Any ideas on what I'm doing wrong ???

thank

+3
source share
2 answers

If you are talking about accessing the url variable in the debugger, this happens quite a lot. This is not a problem in itself.

+1
source

, . , NSString - .

- , , . , . , .

Cocoa , NSArray, NSString NSDictionary.

, . , , , . ( .)

NSString

NSString *a = @"UTF32.txt";

NSString *b = [NSHomeDirectory() stringByAppendingPathComponent:a];

NSTextStorage *storage = [[NSTextStorage alloc] initWithString:b];

NSString *c = [storage string];

a, b c ( 10.5) (, , Mac OS X v10.5 ). NSString, NSString.

Apple: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#//apple_ref/doc/uid/TP40002974-CH4-SW34

+1

Source: https://habr.com/ru/post/1745913/


All Articles