老派阶层的启蒙

时间:2014-08-16 20:53:45

标签: ios objective-c xcode

我正在浏览Big Nerd Ranch iOS编程指南,其中一个教程告诉您如何制作一个只需将设备位置打印到控制台的应用程序。我完全遵循了他们的代码,但是当我运行应用程序时仍然出现错误。我正在使用的这本书是前一年的版本所以我猜这个错误与xcode或类似的东西有关。这本书告诉我编写以一种令人讨厌的方式启动对象的方法,我也认为它可能与它有关。任何关于为什么这个简单的应用程序不起作用的想法将不胜感激。下面是我的viewcontroller.m和viewcontroller.h文件以及运行时打印到控制台的错误。

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface WhereamiViewController : UIViewController
{
    CLLocationManager *locationManager;
}

@end

#import "WhereamiViewController.h"

@implementation WhereamiViewController

- (id)initWithNibName:(NSString *)nibNameOrNil
               bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {
        //Create location manager object
        locationManager = [[CLLocationManager alloc] init];

        [locationManager setDelegate:self];

        //Make location as accurate as possible
        [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

        //Look for location immediately
        [locationManager startUpdatingLocation];
    }
    return self;
}

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    NSLog(@"New Location: %@", newLocation);
}

- (void)locationManager:(CLLocationManager *)manager
       didFailWithError:(NSError *)error
{
    NSLog(@"Could not find location: %@", error);
}

@end

2014-08-16 13:25:22.295 Whereami[2832:60b] Cannot find executable for CFBundle 0x9650af0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/GeoServices.axbundle> (not loaded)
2014-08-16 13:25:22.298 Whereami[2832:60b] Cannot find executable for CFBundle 0x9255180 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)

1 个答案:

答案 0 :(得分:1)

如果在为模拟器构建时发生这种情况,则应Reset Content and Settings,然后重建。