@implementation ThisObject
-(void)start {
SomeOtherObject *someOtherObject = [SomeOtherObject alloc];
[someOtherObject doSomethingAndCallThisFunctionWhenUrDone:myCallBackFunction :self];
}
-(void)myCallBackFunction {
// :)
}
Run Code Online (Sandbox Code Playgroud)
基本上,我怎样才能做到这一点?
-(void)myFunction {
unichar myBuffer[5];
NSRange range = {0, 3};
NSString *string = [NSString alloc];
string = @"123";
[string getCharacters:myBuffer :range];
}
Run Code Online (Sandbox Code Playgroud)
得到警告
!NSString可能无法响应'-getCharacters ::'
然后在运行时执行SIGABRT.为什么?????或者更好,我怎样才能让它发挥作用?