“无法识别的选择器发送到实例"尽管 ObjC 标志为静态库 [英] "unrecognized selector sent to instance" to a static library despite ObjC flag

查看:25
本文介绍了“无法识别的选择器发送到实例"尽管 ObjC 标志为静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序出现运行时错误:

I'm getting a runtime error in my application:

2011-05-17 09:42:31.124 rxsync[67464:207] *** 由于未捕获的异常NSInvalidArgumentException"而终止应用程序,原因:-[NSMutableURLRequest setHTTPBodyWithFormMultipartValues:fileNames:contentyTypes]:: 无法识别的选择器发送到实例 0x4e3cd90'

这个方法,NSMutableURLRequest setHTTPBodyWithFormMultipartValues: fileNames: contentTypes: usingBoundary:],是由一个静态库定义的,它是我的 .xcworkspace 的一部分.

This method, NSMutableURLRequest setHTTPBodyWithFormMultipartValues: fileNames: contentTypes: usingBoundary:], is defined by a static library that's part of my .xcworkspace.

这是我目前检查的内容:

Here's what I've checked so far:

  1. 静态库包含在我的用库链接二进制阶段.
  2. 我的应用程序的其他链接器标志 (OTHER_LDFLAGS = -ObjC) 中有 ObjC.(事实上​​,我的静态库中也有它,因为它基于相同的 xcconfig 文件.)
  3. 签名在我的 .h 和 .m 文件中是一样的.
  4. 静态库肯定已经重建.
  5. 我已确认我向其发送消息的对象有效.
  1. The static library is included in my Link Binary With Libraries phase.
  2. I have ObjC in the Other Linker Flags (OTHER_LDFLAGS = -ObjC) in my application. (In fact, I have it in my static library, too, since it's based on the same xcconfig file.)
  3. The signature is the same in my .h and .m file.
  4. The static library has definitely been rebuilt.
  5. I have verified that the object I'm sending the message to is valid.

我错过了什么可能性?

我使用的是 Xcode 4.0.2.这是 iPhone 目标.

I'm using Xcode 4.0.2. This is an iPhone target.

推荐答案

您还需要将 -all_load 添加到使用您的静态库的目标的其他链接器标志中.

You additionally need to add -all_load to the Other Linker Flags of the target which is using your static library.

这篇关于“无法识别的选择器发送到实例"尽管 ObjC 标志为静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆