我正在尝试使用 rpetrich 的AppList来动态显示应用列表。但是我在编译时遇到了错误;
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ALApplicationList", referenced from:
objc-class-ref in Settings.mm.9ffba1be.o
ld: symbol(s) not found for architecture armv7
我认为我已将所有必需的头文件和库放置在链接中提到的正确位置,即 theos include文件夹中的头文件和 libapplist.dylib theos'lib文件夹中的。这是我的makefile:
生成文件:
include theos/makefiles/common.mk
BUNDLE_NAME = Settings
Settings_FILES = Settings.mm
Settings_INSTALL_PATH = /Library/PreferenceBundles
Settings_FRAMEWORKS = UIKit
Settings_PRIVATE_FRAMEWORKS = Preferences
Settings_LIBRARIES = applist
Settings_LDFLAGS = -lapplist
include $(THEOS_MAKE_PATH)/bundle.mk
internal-stage::
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/Settings.plist$(ECHO_END)
Settings.mm
#import <Preferences/Preferences.h>
#import <UIKit/UIKit.h>
#import <AppList/ALApplicationList.h> //no error here. compiles fine
@interface SettingsListController: PSListController {
}
@end
@implementation SettingsListController
- (id)specifiers {
if(_specifiers == nil) {
_specifiers = [[self loadSpecifiersFromPlistName:@"Settings" target:self] retain];
}
return _specifiers;
}
@end
@interface ApplicationsList : PSListController
{
BOOL found;
}
@end
@implementation ApplicationsList
- (id)specifiers {
if(_specifiers == nil) {
NSMutableArray *__specifiers = [[[NSMutableArray alloc]init] retain];
ALApplicationList *apps = [ALApplicationList sharedApplicationList]; //list all the apps
NSArray *displayIdentifiers = [[apps.applications allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
return [[apps.applications objectForKey:obj1] caseInsensitiveCompare:[apps.applications objectForKey:obj2]];}]; //sort the apps by display name
// [displayIdentifiers retain]; //make sure it doesn't disappear when you actually need to use it, if you only use it once, release it
if(displayIdentifiers.count > 0)
{
UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle:@"title" message:@"Wow!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
}
for (int i = 0; i < displayIdentifiers.count; i++) {
PSSpecifier* specifier = [PSSpecifier preferenceSpecifierNamed:[displayIdentifiers objectAtIndex:i]
target:self
set:NULL
get:NULL
detail:Nil
cell:PSSwitchCell
edit:Nil];
[specifier setProperty:bundle forKey:@"lazy-bundle"];
specifier->action = @selector(lazyLoadBundle:);
[__specifiers addObject:specifier];
}
[specifier release];
}
_specifiers = [NSArray arrayWithArray:__specifiers];
}
return _specifiers;
}
@end
请告诉我我错过了什么?我真的无法弄清楚这个问题。非常感谢。