Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective-C: Trouble with "MKMapView (delegate) didUpdateUserLocation"
    primarykey
    data
    text
    <p>I'm new to objective-c and I'm trying to understand Xcode.</p> <p>Right now, I'm in really big trouble with the following code:</p> <p>AppDelegate.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import &lt;CoreLocation/CoreLocation.h&gt; #import &lt;MapKit/MapKit.h&gt; @class ViewController; @interface AppDelegate : UIResponder &lt;UIApplicationDelegate, CLLocationManagerDelegate, MKMapViewDelegate&gt; { IBOutlet UIActivityIndicatorView *activityIndicator; IBOutlet UITextField *locationTitleField; IBOutlet MKMapView *worldView; IBOutlet CLLocationManager *locationManager; } @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UIViewController *viewController; @end </code></pre> <p>AppDelegate.m</p> <pre><code> #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 </code></pre> <p>The problem is, when I try to start the app, everything is fine. But the "didUpdateUserLocation" is really driving me nuts. I have turned on the Zombie Objects and now Xcode is telling me:</p> <pre><code>[AppDelegate mapView:didUpdateUserLocation:]: message sent to deallocated instance 0xde1b700 (lldb) </code></pre> <p>I had (!) turned on the new ARC stuff, but I've turned it off, still getting the same error. As you can see, I'm not even having at least one release in my code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload