gpt4 book ai didi

objective-c - IOS NSString 属性在引用类中始终为 nil

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:25:39 25 4
gpt4 key购买 nike

这是我的@interface def;

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

这是我的@实现:

@synthesize imageCacheKeyBase;

然后在 Thumbnail 类中名为 initWithAsset 的方法中:

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

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

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

因此,当 Thumbnail 分配类尝试引用 thumbnail.imageCacheKeyBase 时,该臭东西是 nil。我已经尝试了一百万种不同的方法来让字符串变量作为缩略图的属性。我什至简单地尝试过 self.imageCacheKeyBase = @"dave"。 Nuthin'。我试过保留和保留保留(我知道这很愚蠢,但我正在尝试任何事情。我什至尝试过简单地将属性设为 char *。

我一整天都在研究这个。

请帮忙。

最佳答案

在线的某个地方,有些东西是零。尝试 NSLogging 每个对象或数据类型的值。

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

关于objective-c - IOS NSString 属性在引用类中始终为 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10221563/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com