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

发布于 2024-11-25 07:51:15 字数 4350 浏览 1 评论 0原文

我有一个 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)

I've a TTTableViewController subclass. In the loadView I'm assigning the searchBar to the headerView as shown in TTCatalog:

self.tableView.tableHeaderView = _searchController.searchBar;

When I compile for iPhone Simulator all is ok; when I compile for iOS Device compiler give me an error saying _searchController is undefined.

Someone can point me to the right direction??
I already tried some other solution found here and on net... but nothing seems to resolve the issue...

Below the compiler output (a little long):

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

早茶月光 2024-12-02 07:51:15

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

Well, I resolved changing compiler from GCC 4.2 (System Default) to LVVM 2.

云胡 2024-12-02 07:51:15

而不是:

self.tableView.tableHeaderView = _searchController.searchBar;

尝试:

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

这对我的项目很有帮助!

Instead of:

self.tableView.tableHeaderView = _searchController.searchBar;

try:

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

it was helpful for my project!

扭转时空 2024-12-02 07:51:15

那应该有效。您可能在某处保存了旧的 Three20 标头。

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

That's should work. You might have old three20 headers saved somewhere.

  • Try to clean up your project and rebuild everything.
  • try to delete all the old builds under
    /Users/Luca/Library/Developer/Xcode/DerivedData/.
  • remove any reference to three20 in the build settings and run the three20 script again on your project
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文