我知道堆栈上已经有一些关于此的问题,并且我已经全部解决了。
当我调试时,调用委托方法的代码行似乎被忽略了。这是行:
[_delegate insertDataLocation:dbLocation Time:dbTime Reminder:dbReminder];
我假设这是代理设置不正确的问题,所以我是这样设置的:
视图控制器.h
@protocol mapDelegate;
@interface ViewController : UIViewController
@property (strong, nonatomic) id<mapDelegate> delegate;
视图控制器.m
@synthesize delegate = _delegate;
- (void)viewDidLoad
{
[super viewDidLoad];
[self setDelegate:_delegate];
}
//Here's where I call the method, FYI
[_delegate insertDataLocation:dbLocation Time:dbTime Reminder:dbReminder];
AppDelegate.h
@protocol mapDelegate
-(void)insertDataLocation:(NSString*)l Time:(NSString*)t Reminder:(NSString*)r;
@end
@interface AppDelegate : UIResponder <UIApplicationDelegate, mapDelegate>
AppDelegate.m
-(void)insertDataLocation:(NSString*)l Time:(NSString*)t Reminder:(NSString*)r {
//Here's my method's code
}