0

i have an NSMutable array function in ExercisesViewController.m and want to call that array into ExercisesView.m.

ExerciseViewController.m

- (NSMutableArray*)qBlock{

NSURL *url = [NSURL URLWithString:@"http://someaddress.php"];
NSError *error;
NSStringEncoding encoding;
NSString *response = [[NSString alloc] initWithContentsOfURL:url 
                                                usedEncoding:&encoding 
                                                       error:&error];
const char *convert = [response UTF8String];
NSString *responseString = [NSString stringWithUTF8String:convert];
NSMutableArray *sample = [responseString JSONValue];


return sample;}

ExercisesView.m:

 - (id) initWithParentViewController:(ExercisesViewController *)parent {
if ((self = [super init])) {
    // Update this to initialize the view with your own frame size
    [self setFrame:CGRectMake(0, 0, 320, 460)];
    refParentViewController = parent;
    NSMutableArray *qnBlock = [refParentViewController:qBlock];}

But there seems to be some error in linking the reference. I just have a gut feeling its syntax issue. Any pointers?

1 Answer 1

2

It's just a syntax error. Try this:

NSMutableArray *qnBlock = [refParentViewController qBlock];
Sign up to request clarification or add additional context in comments.

2 Comments

i did but the error returned:Instance method '-qBlock' not found (return type defaults to 'id')
Check that you also have a declaration of your method in your ExerciseViewController.h file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.