本文介绍了使用未声明的标识符 self的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个名为 Data parsing 的类,在这个类中,我布置了三个函数:
I created a class named Data parsing and in this class, I laid out three functions:
第一个是getData()
,需要调用parseLine()
.
我像这样调用 parseLine()
方法:
I am calling the parseLine()
method like so:
[self parseline];
但是,我收到以下错误:
However, I am receiving the following error:
Sse of undeclared identifier 'self'
我在这个类中的函数是如何相互调用的?
How are my functions in this class suppose to call each other?
void getData(NSString *data) {
while(temp_top < [data length]) {
icc_data[++data_top] = [data characterAtIndex:temp_top];
if (icc_data[data_top]==')' && icc_data[data_top -1]=='\031') { }
if (icc_data[0]!='\031' && icc_data[data_top]=='\n') {
[dataParsing parseLine];
}
}
}
推荐答案
您正在将 void getData(NSString *data)
实现为 C 函数.函数没有获得对 self
的引用.改用一个方法:
You are implementing void getData(NSString *data)
as a C function. Functions do not get a reference to self
. Use a method instead:
- (void)data
{
}
这篇关于使用未声明的标识符 self的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!