Three20 无法在 iOS 设备上编译,因为 _searchController 未在 TTTableViewController 子类中定义

问题描述 投票:0回答:3

我有一个 TTTableViewController 子类。在 loadView 中,我将 searchBar 分配给 headerView,如 TTCatalog 所示:

self.tableView.tableHeaderView = _searchController.searchBar;

当我为 iPhone Simulator 编译时一切正常;当我为 iOS 设备编译器进行编译时,出现错误,提示 _searchController 未定义。

有人可以指出我正确的方向吗? 我已经尝试过在这里和网上找到的其他解决方案...但似乎没有任何方法可以解决问题...

编译器输出下方(有点长):

CompileC /Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/Objects-normal/armv7/SearchProducts.o QShopping/Classes/SearchProducts.m normal armv7 objective-c com.apple.compilers.llvmgcc42 cd /Users/Luca/Dropbox/XcodeProjects/QShopping setenv LANG en_US.US-ASCII setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -x objective-c -arch armv7 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -DDEBUG -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk -gdwarf-2 -mthumb -miphoneos-version-min=4.0 -iquote /Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/QShopping-generated-files.hmap -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/QShopping-own-target-headers.hmap -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/QShopping-all-target-headers.hmap -iquote /Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/QShopping-project-headers.hmap -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Products/Debug-iphoneos/include -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Products/Debug-iphoneos/../three20 -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Products/Debug-iphoneos/../../three20 -I../three20/Build/Products/three20 -I/Users/Luca/Dropbox/XcodeProjects/QShopping/RestKit/Build -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Products/Debug-iphoneos/../../three20 -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/DerivedSources/armv7 -I/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/DerivedSources -F/Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Products/Debug-iphoneos -include /Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/PrecompiledHeaders/QShopping-Prefix-equrcyqgwoemcbaiznvexuztfkfm/QShopping-Prefix.pch -c /Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m -o /Users/Luca/Library/Developer/Xcode/DerivedData/QShopping-eggzghjfaglpblfzueetmvwsljou/Build/Intermediates/QShopping.build/Debug-iphoneos/QShopping.build/Objects-normal/armv7/SearchProducts.o

/Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m: In function '-[SearchProducts loadView]': /Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m:121: error: '_searchController' undeclared (first use in this function) /Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m:121: error: (Each undeclared identifier is reported only once /Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m:121: error: for each function it appears in.) /Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m: In function '-[SearchProducts textField:didSelectObject:]': /Users/Luca/Dropbox/XcodeProjects/QShopping/QShopping/Classes/SearchProducts.m:180: error: '_searchController' undeclared (first use in this function)
ios xcode4 three20
3个回答
2
投票

嗯,我解决了将编译器从 GCC 4.2(系统默认)更改为 LVVM 2 的问题。


1
投票

代替:

self.tableView.tableHeaderView = _searchController.searchBar;

尝试:

self.tableView.tableHeaderView = self.searchDisplayController.searchBar;

这对我的项目很有帮助!


0
投票

这应该可行。您可能在某处保存了旧的 Three20 标头。

  • 尝试清理您的项目并重建所有内容。
  • 尝试删除下所有旧版本
    /Users/Luca/Library/Developer/Xcode/DerivedData/
  • 删除构建设置中对 Three20 的任何引用,并在您的项目上再次运行 Three20 脚本
© www.soinside.com 2019 - 2024. All rights reserved.