30
2019
09

private api

 Class LSApplicationWorkspace = objc_getClass("LSApplicationWorkspace");        id workspace = [LSApplicationWorkspace  performSelector:NSSelectorFromString(@"defaultWorkspace")];    NS
30
2019
09

获得当前 App 的所有类, 当前 App 可见类.

#import <objc/runtime.h> #import <dlfcn.h> #import <mach-o/ldsyms.h> unsigned int count;     const char **classess;     Dl_info info;   
05
2019
09

WKWebView DEBUG

#ifdef DEBUG  SEL sel = NSSelectorFromString(@"_enableRemoteInspector");  id cls = NSClassFromString(@"WebView");  IMP imp = [cls sel];  void (*func)(id, SEL) = (void *)imp;  func(cls, sel);#endifadd to&nb
30
2018
10

Carplay NSIndexPath 对应关系.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ffffff; background-color: #000000} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #00a0ff; background-color: #000000} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font:
07
2018
08

getTotalDiskSize

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 22.0px Menlo; color: #ffffff; background-color: #000000} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; background-color: #000000; min-height: 14.0px} span.s1 {color: #de38a5} span.s2 {c
27
2017
09

Keypath for any element in embedded NSArray

@interface NSArray (SubscriptKey) @end @implementation NSArray (SubscriptKey) - (id)valueForUndefinedKey:(NSString *)key {     if ([key isEqualToString:@"size"]) { &
31
2017
08

Assembler Directives

This chapter describes assembler directives (also known as pseudo operations, or pseudo-ops), which allow control over the actions of the assembler.Directives for Designating the Current SectionThe assembler supports designation of arbitrar
16
2017
08

读取数据(嵌入的plist)链接通过-sectcreate __TEXT为可执行

我用连接使用的plist一个可执行-sectcreate __TEXT连接器选项。clang -Wl,-sectcreate,__TEXT,__info_plist,info.plist -dynamiclib -o a.dylib a.cppotool你可以用otool(1)转储包含嵌入的plist的部分内容:otool -s __TEXT __info_plist /path/to/executable 然后通过管道将其输出,以便获得相应的ASCII表示XXD(1):otool -
09
2017
08

shared library is loaded auto run

It's run when a shared library is loaded, typically during program startup.1. before mainvoid tmain() __attribute__((constructor(101))){     printf("abc\n"); }2.module inittypedef  void (IN
07
2017
08

宏的更高级应用.

当中 objc源文件中要写一个 JS 代码或 json, 怎样让它语法高亮方法如下:定义一个红#define JS(x) #x但上面的红有个问题,就是宏中不能有逗号,解决方案如下:p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 19.0px Helvetica; color: #eb905a; background-color: #000000}#define JS(...) #__VA_ARGS__实际效果如下.