ios9上获取前台appId的问题

在网上搜到的代码都是使用dlopen的方式去加载,但是我编译的时候,一直提示返回值类型不匹配的问题,报错如下:
cannot initialize a variable of type ‘int (*)()’ with an rvalue of type
‘void *’
int (*SBSSpringBoardServerPort)() = dlsym(uikit, “SBSSpringBoardServerPort”);

这是我参照的代码:
void* uikit = dlopen("/System/Library/Framework/UIKit.framework/UIKit", RTLD_LAZY);
int (*SBSSpringBoardServerPort)() = dlsym(uikit, “SBSSpringBoardServerPort”);
mach_port_t *p = (mach_port_t *)SBSSpringBoardServerPort();
dlclose(uikit);

void* sbserv = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);

NSArray* (*SBSCopyApplicationDisplayIdentifiers)(mach_port_t* port, BOOL runningApps, BOOL debuggablet) =
dlsym(sbserv, "SBSCopyApplicationDisplayIdentifiers");

NSArray *currentArr = SBSCopyApplicationDisplayIdentifiers(p, YES, YES);

NSLog(@"%@", currentArr);

有大佬做过这种吗,万分感谢

这不就是编译问题吗,dlsym前面强转成你接收的函数类型,好好理解一下报错里写的啥

多谢提醒,一直陷在参考的代码里,没注意到这个

赞, 感谢大佬