objective c - Trouble calling method from another class -


object1.h

#import <foundation/foundation.h> @interface object1 : nsobject  + (id) randomobject;  @end 

object1.m

#import "object1.h" @implementation object1  + (id) randomobject{     ... }  @end 

viewcontroller.m

#import "viewcontroller.h" #import "object1.h"  @interface viewcontroller () @end  @implementation viewcontroller ... -(ibaction)randbutton:(id)sender{     object1 *ro1=[[object1 alloc]init];     [ro1 randomobject]; //issue here }  @end 

i getting issue "no visible @interface 'object1' declares selector 'randomobject'" , i'm not entirely sure i'm supposed make visible it's in imported object1.h file.

how work?

[edit: missed line]

when use + create class method , access class method don't create object, call:

 //[class_name method_name]; [object1 randomobject]; 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -