내 iPhone 응용 프로그램에 http://github.com/facebook/three20을 사용하고 있습니다. 프로젝트에 프레임 워크를 포함하기 위해 지침을 따랐습니다. 저는 지금 두 번 확인했습니다 (Google 그룹 및 IRC에있는 사람들의 추천에 따라). 나는 Three20 코드의 일부는 UIView의에 카탈로그 선택기를 사용하려고 다음과 같은 오류가 발생합니다 :Obj-c에서 셀렉터가 없습니다. Three20 라이브러리 카탈로그
- [TTSearchTextField ancestorOrSelfWithClass :] : 인식 할 수없는 선택기 인스턴스 0x3a85ee0 '로 전송
내가 터치하면이 예외가 트리거 텍스트 필드
TTSearchTextField에 데이터 소스를 지정하지 않으면 오류가 발생하지 않습니다. 그래서, 논리적으로 나는 그것이 내 dataSource가되어야한다고 생각했다.
- 데이터 소스의 모든 기능에 중단 점을 배치했습니다.
- 예상대로 프로그램이 시작되고 액세스 자 대리자가 호출되었습니다.
- 텍스트 필드를 두드리고, 내 dataSource를 호출하지 않으며 런타임 예외가 발생합니다.
나는이 하나에 난처합니다. 이전에는 카탈로그가있는 외부 라이브러리를 사용하는 데 문제가 없었습니다. 프로젝트 설정에 대한 더 많은 정보를 제공 할 수 있습니다. 정보가 상당히 많기 때문에 구체적으로 물어보십시오. 나는이 TTSearchTextField을 만들 사용하고
코드 : 내 데이터 소스에 대한
// setup Country
self.searchFieldCountry = [[TTSearchTextField alloc]initWithFrame:CGRectMake(156, 145, 146, 37)];
self.searchFieldCountry.borderStyle = UITextBorderStyleRoundedRect;
self.searchFieldCountry.placeholder = @"Country";
self.searchFieldCountry.autocapitalizationType = UITextAutocapitalizationTypeNone;
OLLocationSearchDataSource *ds = [[OLLocationSearchDataSource alloc]init];
self.searchFieldCountry.dataSource = ds;
[self.view addSubview:self.searchFieldCountry];
[ds release];
코드 :
#import "OLLocation.h"
#import "AppSession.h"
@implementation OLLocation
@synthesize locationData = _locationData;
@synthesize locationMode,country,region;
- (NSMutableArray*)delegates {
if (!_delegates) {
_delegates = TTCreateNonRetainingArray();
}
return _delegates;
}
- (BOOL)isLoadingMore {
return NO;
}
- (BOOL)isOutdated {
return NO;
}
- (BOOL)isLoaded {
return !!_AllLocationData;
}
- (BOOL)isLoading {
return NO;
}
- (BOOL)isEmpty {
return !_AllLocationData.count;
}
- (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more {
}
- (void)invalidate:(BOOL)erase {
}
- (void)cancel {
// cancel a search if possible
}
- (void)loadNames {
_AllLocationData = [[AppSession getAppSession] getCountries];
}
- (void)search:(NSString*)text {
[self cancel];
self.locationData = [NSMutableArray array];
if (text.length) {
text = [text lowercaseString];
for (NSString* name in _AllLocationData) {
if ([[name lowercaseString] rangeOfString:text].location == 0) {
[_locationData addObject:name];
}
}
}
}
- (void)dealloc {
[super dealloc];
}
@end
@implementation OLLocationSearchDataSource
@synthesize locations = _locations;
-(id)init {
if (self = [super init]) {
_locations = [[OLLocation alloc] init];
_locations.locationMode = OLLocationModeCountry;
self.model = _locations;
}
return self;
}
-(void)dealloc {
TT_RELEASE_SAFELY(_locations);
[super dealloc];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewDataSource
- (void)tableViewDidLoadModel:(UITableView*)tableView {
self.items = [NSMutableArray array];
for (NSString* name in _locations.locationData) {
TTTableItem* item = [TTTableTextItem itemWithText:name URL:@"http://google.com"];
[_items addObject:item];
}
}
- (void)search:(NSString*)text {
[_locations search:text];
}
- (NSString*)titleForLoading:(BOOL)reloading {
return @"Searching...";
}
- (NSString*)titleForNoData {
return @"No names found";
}
@end
실제로. 이것이 바로 IRC와 메일 링리스트의 사람들이 제안한 것입니다. 이것은 3.x 프로젝트이고 다른 링커 플래그에는 -ObjC와 -all_load가 있습니다. 다른 제안? 컴파일 할 때 실제로 그 플래그를 적용하는지 확인하는 방법이 있는지 궁금합니다 ... – jsapara
이 프로젝트의 빌드 프로세스를 디버깅하고 링크 할 때 -all_load를 사용하지 않는 것으로 나타났습니다. 프로젝트는이를 명확하게 정의하지만, 우리의 빌드 타겟에 적용되지는 않았습니다. 나는 들어가서 타겟에 -all_load를 추가했는데 이제는 작동합니다. Three20을 사용하는 이전 프로젝트로 돌아 가면 링커 플래그가 프로젝트에 정의되어 있습니다. 새 프로젝트를 만들고 신속한 Three20 UI 위젯을 던져 프로젝트 (대상이 아님)에 링커 플래그를 추가했습니다. 잘 작동하므로 Xcode 파일과 관련하여 이상하거나 손상된 내용이 있어야합니다. 어느 쪽이든, 그것은 해결되었습니다. – jsapara