gpt4 book ai didi

ios - 发送到实例的 NSURL 无法识别的选择器

转载 作者:行者123 更新时间:2023-11-28 22:01:46 25 4
gpt4 key购买 nike

这是代码行

cell.imageURL=[NSURL URLWithString:self.imageURLs[indexPath.row]];

这是错误轨迹

[UITableViewCell setImageURL:]: unrecognized selector sent to instance 0x906da70
2014-07-24 17:16:50.049 MyApp_iOS[9443:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell setImageURL:]: unrecognized selector sent to instance 0x906da70'
*** First throw call stack:
(
0 CoreFoundation 0x01a8c1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016ad8e5 objc_exception_throw + 44
2 CoreFoundation 0x01b29243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01a7c50b ___forwarding___ + 1019
4 CoreFoundation 0x01a7c0ee _CF_forwarding_prep_0 + 14
5 MyApp_iOS 0x0007f518 -[BCDDogViewController tableView:cellForRowAtIndexPath:] + 504
6 UIKit 0x0046611f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412
7 UIKit 0x004661f3 -[UITableView _createPreparedCellForGlobalRow:] + 69
8 UIKit 0x00447ece -[UITableView _updateVisibleCellsNow:] + 2428
9 UIKit 0x0045c6a5 -[UITableView layoutSubviews] + 213
10 UIKit 0x003dc964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
11 libobjc.A.dylib 0x016bf82b -[NSObject performSelector:withObject:] + 70
12 QuartzCore 0x03ef745a -[CALayer layoutSublayers] + 148
13 QuartzCore 0x03eeb244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
14 QuartzCore 0x03eeb0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
15 QuartzCore 0x03e517fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
16 QuartzCore 0x03e52b85 _ZN2CA11Transaction6commitEv + 393
17 QuartzCore 0x03e53258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
18 CoreFoundation 0x01a5436e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
19 CoreFoundation 0x01a542bf __CFRunLoopDoObservers + 399
20 CoreFoundation 0x01a32254 __CFRunLoopRun + 1076
21 CoreFoundation 0x01a319d3 CFRunLoopRunSpecific + 467
22 CoreFoundation 0x01a317eb CFRunLoopRunInMode + 123
23 GraphicsServices 0x03a805ee GSEventRunModal + 192
24 GraphicsServices 0x03a8042b GSEventRun + 104
25 UIKit 0x0036df9b UIApplicationMain + 1225
26 MyApp_iOS 0x000577c2 main + 130
27 libdyld.dylib 0x0216d701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

所讨论的属性是

@property(strong,nonatomic) NSURL *imageURL;

有二传手

-(void)setImageURL:(NSURL *)imageURL
{
_imageURL=imageURL;
[self startDownloadingImage];
}

奇怪的是这曾经工作,大约一个小时前它停止工作并开始抛出这个异常。

更新

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
BCDDogImageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[BCDDogImageTableViewCell cellPrototypeIdentifier] forIndexPath:indexPath];
NSLog(@"THE CELL IS: %@ ", cell);
cell.imageURL=[NSURL URLWithString:self.imageURLs[indexPath.row]];
return cell;
}

最佳答案

错误是因为您的单元格实际上是一个 UITableViewCell 实例,而不是您的自定义单元格类的实例。

请务必为该单元格注册您的自定义单元格类。

关于ios - 发送到实例的 NSURL 无法识别的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24946230/

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