你能帮我解决这个错误吗?我用ARC和非ARC试过这段代码.用ARC就可以了.但非ARC.我该怎么办?请帮帮我.^ __ ^;
当我按下按钮时,会发生错误.**
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
void (^_myOne)(void);
UIView* _viewOne;
}
@property (nonatomic, retain) void (^myOne)(void);
@property (nonatomic, retain) UIView* viewOne;
- (void)useFirstOne:(void(^)(void))blockOne;
@end
#import "FirstViewController.h"
@implementation FirstViewController
@synthesize myOne = _myOne, viewOne = _viewOne;
- (void)useFirstOne:(void (^)(void))blockOne {
blockOne ();
}
- (void)buttonPressed {
[self useFirstOne:self.myOne]; //If I put this line into 'viewDidLoad', has no problem.
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor redColor];
UIButton* buttonA = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buttonA.frame = CGRectMake(0, …Run Code Online (Sandbox Code Playgroud) memory-leaks objective-c ios objective-c-blocks automatic-ref-counting