ksnowlv

回顾过去,总结以往;立足现在,铭记当下;技术为主,笔记而已.

XCode6下Too Many Arguments to Function Call, Expected 0, Have 2解决办法

| Comments

在XCode6下,写了如下一段代码:

1
2
3
   NSLock *myLock = [NSLock new];
   IMP lockIMP = [myLock methodForSelector:lockSEL];
   lockIMP(myLock,lockSEL);

总是报错

“Too many arguments to function call, expected 0, have 2”

后来发现在使用objc_msgSend编译时,与IMP报错类似。

原来是LLVM升级后,增加一些默认设置

objc_msgSend without a typecast is usually an error  
Recommended build setting for strict checking

那我们在Build Setting–>Apple LLVM 6.0 – Preprocessing下,把Enable Strict Check for objc_msgSend Call设置为NO即可。

image

Comments

comments powered by Disqus
Included file 'custom/after_footer.html' not found in _includes directory