theos创建了一个dylib,而不是调整

时间:2011-09-14 14:56:25

标签: objective-c ios cocoa-touch jailbreak

我注意到theos可以构建库并生成dylib,我尝试像

这样的简单代码
static UIAlertView *alert_view;
static void showAlert() {
    alert_view = [[UIAlertView alloc] initWithTitle:@"Welcome" 
                                                    message:@"Welcome to your iPhone Brandon!" 
                                                   delegate:nil 
                                          cancelButtonTitle:@"Thanks" 
                                          otherButtonTitles:nil];
    [alert_view show];
    [alert_view release];
}

make后我得到了一个dylib,但我尝试构建一个测试项目来使用这个dylib,失败了。 我的测试代码如

void* sdl_library = dlopen("/tmp/AlertDylib.dylib", RTLD_LAZY);
if(sdl_library == NULL) {
    NSLog(@"fail load");
} else {
    // use the result in a call to dlsym
    void* showAlert = dlsym(sdl_library,"showAlert");
    if(showAlert == NULL) {
        NSLog(@"fail got function");
    } else {
        // cast initializer to its proper type and use
    }
}

我确定我把dylib文件放在/ tmp /下,但是日志说“失败了功能”,我错过了哪些步骤?

0 个答案:

没有答案