开发者

invove the function having one argument after perticular time period using performselector [duplicate]

This question already has an answer here: Closed 10 years ago.

Possible Duplicate:

How to use performselector to involve the function with argument after particular time period

I am new to this i phone app programming. I have a function with one argument type as structure pointer. This is shown below

-(void)responce:(structurePtr *)someData
{
......
......
}

I want to call this function using performselector method after 5 seconds of time interval.

I have used below code to perform the activity

[self performSelector:@selector(res开发者_如何学JAVAponce:) withObject:someData afterDelay:5];

this is not even called the responce function. By executing above performselector it is crashing and showing the EXc_BAD_ACCESS message.

please tell me why it is not calling the responce function.

one more thing is that it is showing one warning in above performSelector calling as "passing argument 2 of performSelector: withObject: afterDelay: from incompatable pointer type"


     It looks like that your structurePtr is a plain c structure and performSelector: requires 2nd parameter to be a obj-c object (an id type).
     It is also may be a good policy to build your project with "Treat warning as errors" option on. Very often warning at compile time become run-time errors...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜