AFNetworking 데이터베이스에서 정보를 가져와야하는 CodeSchool 프로젝트를 진행 중입니다. 나는 그 모든 일을했고 거기에 내 코드에 오류가 있지만 그것을 디버그하고 ProfileViewController 클릭하면 스레드 1 신호 SIGABRT 얻을. 여기 스레드 1 신호 SIGABRT
은 ProfileViewController.m의 코드입니다 :#import "ProfileViewController.h"
#import "UIKit+AFNetworking/UIImageView+AFNetworking.h"
@interface ProfileViewController()
@end
@implementation ProfileViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = @"Profile";
self.tabBarItem.image = [UIImage imageNamed:@"tab_icon_profile"];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.scrollView =[[UIScrollView alloc] initWithFrame:self.view.bounds];
self.scrollView.contentSize = CGSizeMake(320, 480);
self.scrollView.autoresizingMask = (UIViewAutoresizingFlexibleHeight| UIViewAutoresizingFlexibleWidth);
self.view.backgroundColor = [UIColor darkGrayColor];
UIImageView *bigBirdView = [[UIImageView alloc] init];
bigBirdView.frame = CGRectMake(20, 20, 100, 114);
[bigBirdView setImageWithURL:[NSURL URLWithString:@"http://images3.wikia.nocookie.net/__cb20100901224145/muppet/images/f/f8/Big-bird-NEW.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
[self.scrollView addSubview:bigBirdView];
UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 140, 280, 40)];
[nameLabel setBackgroundColor:[UIColor clearColor]];
[nameLabel setTextColor:[UIColor whiteColor]];
nameLabel.text = @"Name: Big Bird";
[self.scrollView addSubview:nameLabel];
UILabel *cityLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 200, 280, 40)];
[cityLabel setBackgroundColor:[UIColor clearColor]];
[cityLabel setTextColor:[UIColor whiteColor]];
cityLabel.text = @"From: Sesame Street";
[self.scrollView addSubview:cityLabel];
UITextView *biography= [[UITextView alloc] initWithFrame:CGRectMake(12, 260, 200, 200)];
[biography setBackgroundColor:[UIColor clearColor]];
biography.font = [UIFont fontWithName:@"Helvetica" size:15];
[biography setTextColor:[UIColor whiteColor]];
biography.editable = NO;
biography.text = @"Big Bird likes long walks on the beach, hanging with friends, and singing songs about various subjects. Big Bird is also really into organic bird seed.";
[self.scrollView addSubview:biography];
UILabel *memberSince = [[UILabel alloc] initWithFrame:CGRectMake(20, 400, 280, 40)];
[memberSince setBackgroundColor:[UIColor clearColor]];
[memberSince setTextColor:[UIColor whiteColor]];
memberSince.text = @"Member Since: 1969";
[self.scrollView addSubview:memberSince];
[self.view addSubview:self.scrollView];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
여기에 lldl에 BT를 포함하여 전체 오류입니다 :
(lldb) bt
* thread #1: tid = 0x28a71, 0x05b6fa6a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread, stop reason = signal SIGABRT
frame #0: 0x05b6fa6a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x05a2bb2f libsystem_c.dylib`pthread_kill + 101
frame #2: 0x057b2e12 libsystem_sim_c.dylib`abort + 127
frame #3: 0x055a69f9 libc++abi.dylib`abort_message + 105
frame #4: 0x055c76ab libc++abi.dylib`default_terminate_handler() + 292
frame #5: 0x014beb64 libobjc.A.dylib`_objc_terminate() + 108
frame #6: 0x055c4f60 libc++abi.dylib`std::__terminate(void (*)()) + 14
frame #7: 0x055c497d libc++abi.dylib`__cxa_throw + 116
frame #8: 0x014be9cd libobjc.A.dylib`objc_exception_throw + 323
frame #9: 0x023fd903 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 275
frame #10: 0x0235090b CoreFoundation`___forwarding___ + 1019
frame #11: 0x023504ee CoreFoundation`_CF_forwarding_prep_0 + 14
frame #12: 0x0000415c InstaPhoto`-[ProfileViewController viewDidLoad](self=0x0899ef40, _cmd=0x007b1d27) + 1260 at ProfileViewController.m:39
frame #13: 0x001379a8 UIKit`-[UIViewController loadViewIfRequired] + 696
frame #14: 0x0015d1a5 UIKit`-[UINavigationController _layoutViewController:] + 39
frame #15: 0x0015d6bb UIKit`-[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
frame #16: 0x0015d7b3 UIKit`-[UINavigationController _startTransition:fromViewController:toViewController:] + 78
frame #17: 0x0015e72c UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 645
frame #18: 0x0015f349 UIKit`-[UINavigationController __viewWillLayoutSubviews] + 57
frame #19: 0x0029839d UIKit`-[UILayoutContainerView layoutSubviews] + 213
frame #20: 0x0008edd7 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
frame #21: 0x014d081f libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #22: 0x029fc72a QuartzCore`-[CALayer layoutSublayers] + 148
frame #23: 0x029f0514 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #24: 0x029f0380 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #25: 0x02958156 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
frame #26: 0x029594e1 QuartzCore`CA::Transaction::commit() + 393
frame #27: 0x02a15870 QuartzCore`+[CATransaction flush] + 52
frame #28: 0x00040979 UIKit`_afterCACommitHandler + 131
frame #29: 0x0232853e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #30: 0x0232848f CoreFoundation`__CFRunLoopDoObservers + 399
frame #31: 0x023063b4 CoreFoundation`__CFRunLoopRun + 1076
frame #32: 0x02305b33 CoreFoundation`CFRunLoopRunSpecific + 467
frame #33: 0x0230594b CoreFoundation`CFRunLoopRunInMode + 123
frame #34: 0x022bc9d7 GraphicsServices`GSEventRunModal + 192
frame #35: 0x022bc7fe GraphicsServices`GSEventRun + 104
frame #36: 0x0002494b UIKit`UIApplicationMain + 1225
frame #37: 0x00001add InstaPhoto`main(argc=1, argv=0xbfffee84) + 141 at main.m:16
(lldb)
ProfileViewController는 viewDidLoad를 구현하는 UIViewController에서 상속받습니다. 서브 클래스가 커스텀 구현을 제공 할 필요는 없습니다. –
어떻게 해결할 수 있습니까? viewDidLoad의 사용자 정의 구현을 수행해야합니까? 아니면이 코드에서 다시 정렬하거나 변경해야 할 부분이 있습니까? 도와 주셔서 정말 고맙습니다. – user2832346
ProfileViewController.m의 39 행에있는 코드 행을 확인할 수 있습니까? 게시 된 샘플에서 39 행 뒤에 공백 라인 : [self.scrollView addSubview : bigBirdView]; –