【问题标题】:no visible @interface for 'UIApplication' declares the selector 'launchApplicationWithIdentifier'\'UIApplication\' 没有可见的@interface 声明选择器 \'launchApplicationWithIdentifier\'
【发布时间】:2022-08-05 00:36:56
【问题描述】:

我刚刚开始学习如何编写 iOS 调整。试图在theos中写一个tweak,但是这部分代码:

#import <UIKit/UIKit.h>

%hook SBStatusBarManager

- (void) handleStatusBarTapWithEvent: (id)arg1{

    [[UIApplication sharedApplication] launchApplicationWithIdentifier: @\"com.apple.mobilesafari\" suspended: NO];
    %orig;
}

%end

在编译时给出错误:

Tweak.x:7:40: error: no visible @interface for \'UIApplication\' declares the selector \'launchApplicationWithIdentifier:suspended:\'
    [[UIApplication sharedApplication] launchApplicationWithIdentifier: @\"com.apple.mobilesafari\" suspended: NO];


1 error generated.
make[3]: *** [/Users/deckard/test/.theos/obj/debug/armv7/Tweak.x.7f1f218f.o] Error 1
make[2]: *** [/Users/deckard/test/.theos/obj/debug/armv7/test.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [test.all.tweak.variables] Error 2

这个方法是我从http://www.iphonedevwiki.net/index.php/UIApplication 得到的。你能告诉我我的错误在哪里,或者这段代码不应该工作吗?谢谢!

    标签: ios uikit jailbreak uiapplication theos


    【解决方案1】:

    'UIApplication' 没有可见的@interface

    表示没有导入 UIApplication 标头。

    声明选择器'launchApplicationWithIdentifier:suspended:'

    表示所述标头必须包含声明的launchApplicationWithIdentifier:suspended: 选择器。

    Here 是您可以使用的示例头文件,您可以删除不需要的任何声明或保持原样。将其复制到您的调整目录,然后将其导入:

    #import "UIApplication2.h"

    【讨论】:

      猜你喜欢
      • 2016-12-28
      • 1970-01-01
      • 2017-06-05
      • 1970-01-01
      • 1970-01-01
      • 2012-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多