#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@interface ViewController : UIViewController<CLLocationManagerDelegate>
{
CLLocationManager *_locationManager;
}
@property (strong, nonatomic) IBOutlet UISwitch *locationUpdatesSwitch;
@property (strong, nonatomic) IBOutlet UILabel *locationInformationLabel;
- (IBAction)toggleLocationUpdates:(id)sender;
{ //EXPECTED IDENTIFIER OR "("
if (self.locationUpdatesSwitch.on == YES)
{
if ([CLLocationManager locationServicesEnabled] == NO)
{
UIAlertView *locationServicesDisabledAlert =
[[UIAlertView alloc] initWithTitle:@"Location Services Disabled"
message:@"This feature requires location services. Enable it in the privacy settingson your device"
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[locationServicesDisabledAlert show];
self.locationUpdatesSwitch.on = NO;
return;
}
}
else
{
// Switch was turned Off
}
}
小さなコア ロケーション ベースの xcode プロジェクトに取り組もうとしています。誰かがここで私を助けてくれますか? 何が欠けているのかわかりませんが、- (IBAction)toggleLocationUpdates:(id)sender; の直後に「予期される識別子または「(」」エラーが発生します。
前もって感謝します!