2013-09-30 2 views
0

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) 

답변

1

귀하의 문제는 ProfileViewController.m 라인 39에 있습니다 :

frame #12: 0x0000415c InstaPhoto`- [ProfileViewController viewDidLoad](self=0x0899ef40, _cmd=0x007b1d27) + 1260 at ProfileViewController.m:39 

doesNotRecognizeSelector 예외가 발생되고 :

frame #9: 0x023fd903 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 275 

... 구현되지 않은 메서드가 호출되고 있음을 나타냅니다. 나는 또한 다음 코드에 의심

+0

ProfileViewController는 viewDidLoad를 구현하는 UIViewController에서 상속받습니다. 서브 클래스가 커스텀 구현을 제공 할 필요는 없습니다. –

+0

어떻게 해결할 수 있습니까? viewDidLoad의 사용자 정의 구현을 수행해야합니까? 아니면이 코드에서 다시 정렬하거나 변경해야 할 부분이 있습니까? 도와 주셔서 정말 고맙습니다. – user2832346

+0

ProfileViewController.m의 39 행에있는 코드 행을 확인할 수 있습니까? 게시 된 샘플에서 39 행 뒤에 공백 라인 : [self.scrollView addSubview : bigBirdView]; –

0

,

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]; 

1 일) - setImageWithURL 같은 UIImageView에 사용할 수있는 방법 그들의되지 않습니다 : placeholderImage.

[bigBirdView setImageWithURL:[NSURL URLWithString:@"http://images3.wikia.nocookie.net/__cb20100901224145/muppet/images/f/f8/Big-bird-NEW.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; 

비동기 GCD를 사용하여있는 NSURLConnection 위임/차단 방법 그래를 사용하여 이미지를 다운로드, 당신은 다음 줄을 사용하여 주 스레드에서 이미지를 다운로드하는 이유 - UIImageview

2)의 설명서를 참조하십시오.

관련 문제