나는 objective-c에 익숙하지 않으며 Xcode를 이해하려고합니다.Objective-C : "MKMapView (delegate) didUpdateUserLocation"관련 문제
는 지금, 나는 다음과 같은 코드 정말 큰 문제가 있어요 :
AppDelegate.h
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate, CLLocationManagerDelegate, MKMapViewDelegate> {
IBOutlet UIActivityIndicatorView *activityIndicator;
IBOutlet UITextField *locationTitleField;
IBOutlet MKMapView *worldView;
IBOutlet CLLocationManager *locationManager;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *viewController;
@end
AppDelegate.m
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize window = window;
@synthesize viewController = viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
locationManager = [[CLLocationManager alloc]init];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[worldView setShowsUserLocation:YES];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
// Yes, no code here, but here's the point, where I'm getting crashes, no matter if
// there is some code in here, or not
}
@end
내가하려고 할 때 문제가된다 앱을 시작하면 모든 것이 정상입니다. 그러나 "didUpdateUserLocation"은 정말로 나를 괴롭 히고 있습니다. 나는 좀비 개체 설정 한 지금 엑스 코드는 저를 말하고있다 :
[AppDelegate mapView:didUpdateUserLocation:]: message sent to deallocated instance 0xde1b700
(lldb)
는 내가 가진 새로운 ARC 물건에 설정,하지만 난 여전히 같은 오류가 발생, 그것을 해제 한 (!). 보시다시피, 나는 적어도 내 코드에 하나의 릴리스가 없다.
어떤 Xcode 버전을 사용하고 있습니까? – wackytacky99
MKMapView에서 그 대리인은 어디에서 연결 했습니까? 나는 당신이 View Controller의 펜촉으로이 작업을 수행했고 AppDelegate의 다른 인스턴스에 연결했다고 추측합니다. –