我有一个名为aroundersViewController
的viewController。我在app委托上有一个名为aroundersVC
的属性。
我从另一个名为monitorLocationViewController
的类发送带有操作的UILocalNotification(iOS 8的交互式通知)。
当用户点击某个操作并且正在调用-application: handleActionWithIdentifier: forLocalNotification: completionHandler:
上的AppDelegate.m
时,mapVC
为零(实际上,在列表aroundersVC
上是&#34 ; 0字节"其中的所有内容都是零):
我能理解为什么?我需要更改aroundersVC
属性中的一个(Arounders
- NSMutableArray
),但我可以;因为它没有。
** willFinishLaunchingWithOptions **:
-(BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.aroundersVC=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"aroundersPage"];
//Initializing "monitorLocationVC"(MonitorLocationViewController)
self.monitorLocationVC=[[monitorLocationViewController alloc] init];
//Setting "monitorLocationVC"(MonitorLocationViewController)'s locationManager
self.monitorLocationVC.locationManager=self.locationManager;
self.aroundersVC.locationManager=self.locationManager;
[self configureLocationManager];
[self.locationManager startUpdatingLocation];
return YES;
}
AroundersViewController的viewDidLoad :
- (void)viewDidLoad {
[super viewDidLoad];
#pragma mark - mapView configurations
//Disabling tilt on "mapView"(GMSMapView)
self.mapView.settings.tiltGestures=NO;
//Setting "mapView"(GMSMapView) minimum zoom to 100 (unlimited zoom in) and maximum to 13
[self.mapView setMinZoom:13 maxZoom:100];
//Animating map to user's current location
//[self animateMapToCurrentLocation];
#pragma mark NSUserDefaults fetch
//Creating "aroundersSave"(NSUserDefaults) to fetch "aroundersSave" (NSUserDefault key for saving all the arounders)
NSUserDefaults *aroundersSave=[NSUserDefaults standardUserDefaults];
//If "aroundersSave"(NSUserDefaults)'s key "aroundersSave" is nil
if ([aroundersSave rm_customObjectForKey:@"aroundersSave"]==nil) {
//Initializing "Arounders"(NSMutableArray) with "New Arounder"(NSString) object
self.Arounders=[[NSMutableArray alloc] initWithObjects:@"New Arounder", nil];
}else //If "aroundersSave"(NSUserDefaults)'s key "aroundersSave" is not nil
{
//Initializing "Arounders"(NSMutableArray) with the array at "aroundersSave"(NSUserDefaults)'s key "aroundersSave"
self.Arounders=[[NSMutableArray alloc] initWithArray:[aroundersSave rm_customObjectForKey:@"aroundersSave"]];
}
#pragma mark "AroundersTableView" general configurations
//Adds extra seperator line on top of the tableview
self.AroundersTableView.tableHeaderView = ({UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.AroundersTableView.frame.size.width, 1.5 / UIScreen.mainScreen.scale)];
line.backgroundColor = self.AroundersTableView.separatorColor;
line;
});
self.AroundersTableView.backgroundColor=[UIColor whiteColor];
self.AroundersTableView.tableHeaderView=nil;
#pragma mark NSNotificationCenter configurations
//Creating NSNotificationCenter observer for calling "addArounderToArounders:" method
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addArounderToAroundersArray:) name:@"callAddArounderToArounders" object:nil];
//Creating NSNotificationCenter observer for calling "deleteCellsFromAroundersTableView:" method
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deleteCellsFromAroundersTableView:) name:@"callDeleteCellsFromAroundersTableView" object:nil];
//Creating NSNotificationCenter observer for calling "getStoresArrays:" method
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getStoresArrays:) name:@"callGetStoresArrays:" object:nil];
//Creating NSNotificationCenter postNotification for calling "getAroundersArray:" method
[[NSNotificationCenter defaultCenter] postNotificationName:@"callGetAroundersArray" object:self userInfo:[NSDictionary dictionaryWithObject:self.Arounders forKey:@"aroundersArray"]];
//Creating NSNotificationCenter observer for calling "callMuteOrUnmute" method
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(callMuteOrUnmute:) name:@"callMuteOrUnmute:" object:nil];
#pragma mark get user's location
//Configuring locationManager
[self configureLocationManager];
//For showing user's current location
[self showCurrentLocation];
//Starting to update user's location
[self.locationManager startUpdatingLocation];
#pragma mark addAllStoresMarkers
[self addAllStoresMarkersToMapView];
}
任何人都知道出了什么问题?谢谢!