Suppose that we have a ViewController.h and .m like this:
1 2 3 4 5 | // ViewController.h #import UIKit/UIKit.h @interface ViewController : UIViewController @end |
1 2 3 4 5 6 7 8 9 10 11 12 | // ViewController.m #import "ViewController.h" #import "SetValue.h" @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [SetValue SetTheValue:@"a string"]; } @end |
And a class called SetValue, with two methods.
1 2 3 4 5 6 7 8 9 | // SetValue.h #import Foundation/Foundation.h @interface SetValue : NSObject { } + (void) SetTheValue:(id)Obj; - (void) MySelector:(id)Obj; @end |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // SetValue.m #import "SetValue.h" @implementation SetValue + (void) SetTheValue:(id)Obj { [self performSelectorOnMainThread:@selector(MySelector:) withObject:Obj waitUntilDone:NO]; } - (void) MySelector:(id)Obj { NSLog(@"Data: %@", [Obj description]); } @end |
What is the value printed by the NSLog?
enjoy.








