English 中文(简体)
• 如何绕过Xcode中的错误警告?
原标题:How to get around incorrect warning in Xcode?

我收到以下警告:

Instance method  method name  not found (return type defaults to  id )

援引该法典时:

@protocol SomeProtocol <NSObject> {
    @property (nonatomic, retain) SpecificClassName* someDelegate;
}
...
+ (void) aMethod : (id <SomeProtocol>) object {
    [object.someDelegate doSomeThing]; // warning statement show up here
}

我感到,此时此刻,汇编者的短程是这样,但仅仅可能是叫ttle黑的pot子......没有人对此有任何反馈?

最佳回答

页: 1 页: 1

如果您在标题档案中重新使用“<代码>光谱ClassName的类型名称,则一份前述声明@密特ClassName将这样做,但在该类别上采用一种方法要求汇编者了解这种方法的返回类型。

如果你想就<代码>SpecificClassName的某一案例使用某种方法,则包括该方法所定义的头盔。

问题回答

我指的是,班级的主人档案不包括方法签名。 因此,汇编者可以说明这种方法是否实际存在。 编队档案,以清除警报。

在 Java或C++,这将是一个汇编失败。 这是因为它们确实在汇编时具有约束力,因此汇编者需要find这些方法。 目标C在操作时间这样做;它向物体发送一种方法,而物体可能或不可能有这种方法。





相关问题
Asynchronous request to the server from background thread

I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

iPhone numberpad with decimal point

I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...

热门标签