Как написано, мое приложение падает сразу после его запуска. Я действительно не знаю, что делать. Спасибо за любую помощь. Вот код:Мое приложение аварийно завершает работу после запуска
#import "ViewController.h"
@import CoreLocation;
@interface ViewController() <CLLocationManagerDelegate>
@property (strong, nonatomic) CLLocationManager *locationManager;
@property (weak, nonatomic) IBOutlet UILabel *location;
@property (weak, nonatomic) IBOutlet UILabel *date;
@end
@implementation ViewController
-(void)viewDidLoad
{
[super viewDidLoad];
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
//date
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMMM d, YYYY"];
NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];
NSLog(@"%@", dateString);
self.date.text = (@"%@", dateString);
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"%@", [locations lastObject]);
self.location.text = (@"%@", [locations lastObject]);
}
@end
После аварии он показывает это: http://i.stack.imgur.com/k0eVO.png
Можете ли вы показать нам, что печатается в отладчике? – Priyatham51
Вы посмотрели http://stackoverflow.com/questions/24850128/ios-8-requestwheninuseauthorization-no-popup? – luk2302
подключить lldb и проверить обратную трассировку – Wingzero