I’m having trouble returning a value to a delegate.
@protocol DataDelegateImage
- (void)failImage;
- (NSData*)successImage;
@end
@property (nonatomic, strong) id <DataDelegateImage> delegateImage;
@property (nonatomic, strong) NSMutableData* d;
And I call my delegates like:
[self.delegateImage failImage];
But now I’m trying to call the success delegate returning the data content, but I think I got something wrong, because the code doesn’t work.
[self.delegateImage successImage:self.d];
Any ideas?
Your passing
self.dto yoursuccessImageand there is no parameter for you to pass anything to it. If you want to be able to pass something to it then it should be like thisor
unless you want something to be returned as well as passing something to it in which cases use
The
typein the brackets- (NSData*)is the return type it should be, this is the type ofobjectthat you want to return from the method. Then your method namesuccessImagethen you would have the parameters:(NSData*)para1you can add more parameters as wellthe
typeinside the brackets of:(NSData*)para1parameters is the object type it takes.Hope this helps.