I wanted to create a counter that updates by one, every time it satisfied a condition in the if block of my code. To achieve this, i implemented a single tone instead of defining a global variable
In .h file………
@interface MONObject : NSObject {
int *counterplus;
}
@property(nonatomic) int *counterplus;
+(MONbject*) sharedinstance;
@end
In the .m file
static MON object * sharedinstance;
@implementation MONbject;
@synthesize counterplus;
+(MONbject*)sharedinstance
{
if(!sharedinstance){
sharedinstance=[[MONObject alloc]init];
}
return sharedinstance
}
-(MONObject*) int
{
self=[super init];
if(0!=self){
counterplus=0;
}
return self;
}
@end
I call the above as…
if(condition){
[MONObject sharedinstance].counterplus++;
}
when i try to print the value of it using NSLog, program stops and give this error
“single stepping until exit from function objc_msgSend, which has no line number informatiopn. warning remote failure reply: E37
I have no clue at all. I tried to used a global variable by defining it as extern and tried to
increment. But it give the same error.
Is there any way to achieve this? Can you please point me the error in it.
It will be –
instead of –
For Logging int values, use –