IOS NSString Property is always nil in the reference class

Here is my @interface def;

@interface Thumbnail : UIView <NSCoding>{
    NSMutableString *imageCacheKeyBase;
}
@property (nonatomic, copy) NSMutableString  *imageCacheKeyBase;
@end

Here is my @implementation:

@synthesize imageCacheKeyBase;

Then in the initWithAsset method in the Thumbnail class:

self.urlString = [[_asset.defaultRepresentation.url absoluteString] copy];
c  = (char*)[urlString UTF8String];

while (*c != '=') 
    ++c;
++c;

self.imageCacheKeyBase = [NSString stringWithFormat:@"%s_", c];

And so when the thumbnail highlighting class tries to reference thumbnail.imageCacheKeyBase, then the stinkin 'thing is zero. I have tried a million different approaches to get a string variable as a thumbnail property. I even tried just self.imageCacheKeyBase = @ "dave". Nuthin. I tried to save and save the save (I know it's stupid, but I tried something. I even tried just making the char * property.

I do this all day.

Help me please.

+3
source share
2 answers

- , - . NSLogging .

NSLog(@"My first string is %@, the char is %s, the final string is %@", [_asset.defaultRepresentation.url absoluteString], c, self.imageCacheKeyBase);
+1

, = URL-. UTF-8 ( , ), - :

self.urlString = [[_asset.defaultRepresentation.url absoluteString] copy];

NSRange range = [self.urlString rangeOfString@"="];
if (range.location != NSNotFound)
{
    self.imageCacheKeyBase = [NSString stringWithFormat:@"%s=", [self.urlString subStringToIndex:range.location];
}

imageCacheKeyBase .h :

@property (nonatomic, retain) NSString *imageCacheKeyBase;

. , , [NSString stringWithFormat... [NSMutableString stringWithFormat.... , , .

self.urlString , @interface. , , , imageCacheKeyBase? , :

NSString* urlString = [_asset.defaultRepresentation.url absoluteString];

absoluteString autorelease, .

0

All Articles