Skip to content

Added confirmation dialog for CoreLocation permissions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 40 additions & 14 deletions Maps.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 47;
objects = {

/* Begin PBXBuildFile section */
4F5E93371D355808007FA4BE /* Testing.gpx in Resources */ = {isa = PBXBuildFile; fileRef = 4F5E93361D355808007FA4BE /* Testing.gpx */; };
4F5E93391D356D72007FA4BE /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F5E93381D356D72007FA4BE /* CoreLocation.framework */; };
4F5E933D1D3591AA007FA4BE /* Track - Jul 05 07-54 PM.gpx in Resources */ = {isa = PBXBuildFile; fileRef = 4F5E933C1D3591AA007FA4BE /* Track - Jul 05 07-54 PM.gpx */; };
CA706936172A0BD900318AF9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA706935172A0BD900318AF9 /* UIKit.framework */; };
CA706938172A0BD900318AF9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA706937172A0BD900318AF9 /* Foundation.framework */; };
CA70693A172A0BD900318AF9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA706939172A0BD900318AF9 /* CoreGraphics.framework */; };
Expand All @@ -23,7 +26,6 @@
CA70695C172A0BD900318AF9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA706937172A0BD900318AF9 /* Foundation.framework */; };
CA706964172A0BD900318AF9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CA706962172A0BD900318AF9 /* InfoPlist.strings */; };
CA706967172A0BD900318AF9 /* MapsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA706966172A0BD900318AF9 /* MapsTests.m */; };
CA706971172A0BFF00318AF9 /* Testing.gpx in Resources */ = {isa = PBXBuildFile; fileRef = CA706970172A0BFF00318AF9 /* Testing.gpx */; };
CA706973172A0C4E00318AF9 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA706972172A0C4E00318AF9 /* MapKit.framework */; };
/* End PBXBuildFile section */

Expand All @@ -38,6 +40,9 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
4F5E93361D355808007FA4BE /* Testing.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Testing.gpx; sourceTree = "<group>"; };
4F5E93381D356D72007FA4BE /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
4F5E933C1D3591AA007FA4BE /* Track - Jul 05 07-54 PM.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Track - Jul 05 07-54 PM.gpx"; sourceTree = "<group>"; };
CA706932172A0BD900318AF9 /* Maps.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Maps.app; sourceTree = BUILT_PRODUCTS_DIR; };
CA706935172A0BD900318AF9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
CA706937172A0BD900318AF9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand All @@ -60,7 +65,6 @@
CA706963172A0BD900318AF9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CA706965172A0BD900318AF9 /* MapsTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MapsTests.h; sourceTree = "<group>"; };
CA706966172A0BD900318AF9 /* MapsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MapsTests.m; sourceTree = "<group>"; };
CA706970172A0BFF00318AF9 /* Testing.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Testing.gpx; sourceTree = "<group>"; };
CA706972172A0C4E00318AF9 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand All @@ -69,6 +73,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4F5E93391D356D72007FA4BE /* CoreLocation.framework in Frameworks */,
CA706973172A0C4E00318AF9 /* MapKit.framework in Frameworks */,
CA706936172A0BD900318AF9 /* UIKit.framework in Frameworks */,
CA706938172A0BD900318AF9 /* Foundation.framework in Frameworks */,
Expand All @@ -92,8 +97,8 @@
CA706929172A0BD900318AF9 = {
isa = PBXGroup;
children = (
CA706972172A0C4E00318AF9 /* MapKit.framework */,
CA706970172A0BFF00318AF9 /* Testing.gpx */,
4F5E93361D355808007FA4BE /* Testing.gpx */,
4F5E933C1D3591AA007FA4BE /* Track - Jul 05 07-54 PM.gpx */,
CA70693B172A0BD900318AF9 /* Maps */,
CA70695F172A0BD900318AF9 /* MapsTests */,
CA706934172A0BD900318AF9 /* Frameworks */,
Expand All @@ -113,6 +118,8 @@
CA706934172A0BD900318AF9 /* Frameworks */ = {
isa = PBXGroup;
children = (
4F5E93381D356D72007FA4BE /* CoreLocation.framework */,
CA706972172A0C4E00318AF9 /* MapKit.framework */,
CA706935172A0BD900318AF9 /* UIKit.framework */,
CA706937172A0BD900318AF9 /* Foundation.framework */,
CA706939172A0BD900318AF9 /* CoreGraphics.framework */,
Expand Down Expand Up @@ -204,7 +211,7 @@
name = MapsTests;
productName = MapsTests;
productReference = CA706958172A0BD900318AF9 /* MapsTests.octest */;
productType = "com.apple.product-type.bundle";
productType = "com.apple.product-type.bundle.ocunit-test";
};
/* End PBXNativeTarget section */

Expand All @@ -213,11 +220,16 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = BPXL;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = Example;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = Rosetrace;
TargetAttributes = {
CA706931172A0BD900318AF9 = {
DevelopmentTeam = GKLUN877QD;
};
};
};
buildConfigurationList = CA70692D172A0BD900318AF9 /* Build configuration list for PBXProject "Maps" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 6.3";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
Expand All @@ -240,11 +252,12 @@
buildActionMask = 2147483647;
files = (
CA706940172A0BD900318AF9 /* InfoPlist.strings in Resources */,
4F5E93371D355808007FA4BE /* Testing.gpx in Resources */,
CA706948172A0BD900318AF9 /* Default.png in Resources */,
CA70694A172A0BD900318AF9 /* [email protected] in Resources */,
4F5E933D1D3591AA007FA4BE /* Track - Jul 05 07-54 PM.gpx in Resources */,
CA70694C172A0BD900318AF9 /* [email protected] in Resources */,
CA706952172A0BD900318AF9 /* BPXLViewController.xib in Resources */,
CA706971172A0BFF00318AF9 /* Testing.gpx in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -345,6 +358,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -356,10 +370,10 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = 2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -381,32 +395,40 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = 2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
CA70696B172A0BD900318AF9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Maps/Maps-Prefix.pch";
INFOPLIST_FILE = "Maps/Maps-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.blackpixel.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
CA70696C172A0BD900318AF9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Maps/Maps-Prefix.pch";
INFOPLIST_FILE = "Maps/Maps-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.blackpixel.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand All @@ -422,6 +444,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Maps/Maps-Prefix.pch";
INFOPLIST_FILE = "MapsTests/MapsTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.blackpixel.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
Expand All @@ -439,6 +462,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Maps/Maps-Prefix.pch";
INFOPLIST_FILE = "MapsTests/MapsTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.blackpixel.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
Expand All @@ -464,6 +488,7 @@
CA70696C172A0BD900318AF9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CA70696D172A0BD900318AF9 /* Build configuration list for PBXNativeTarget "MapsTests" */ = {
isa = XCConfigurationList;
Expand All @@ -472,6 +497,7 @@
CA70696F172A0BD900318AF9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
2 changes: 2 additions & 0 deletions Maps/BPXLAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import <UIKit/UIKit.h>


@class BPXLViewController;

@interface BPXLAppDelegate : UIResponder <UIApplicationDelegate>
Expand All @@ -16,4 +17,5 @@

@property (strong, nonatomic) BPXLViewController *viewController;


@end
6 changes: 5 additions & 1 deletion Maps/BPXLAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@

#import "BPXLViewController.h"


@implementation BPXLAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[BPXLViewController alloc] initWithNibName:@"BPXLViewController" bundle:nil];
self.viewController = [[BPXLViewController alloc] initWithNibName:@"BPXLViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}



- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Expand Down
2 changes: 2 additions & 0 deletions Maps/BPXLViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
//

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

@interface BPXLViewController : UIViewController


@end
20 changes: 19 additions & 1 deletion Maps/BPXLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
//
// Created by Brandon Alexander on 4/25/13.
// Copyright (c) 2013 Example. All rights reserved.
//
//

#import "BPXLViewController.h"

@interface BPXLViewController ()
@interface BPXLViewController () <CLLocationManagerDelegate>
@property (strong, nonatomic) CLLocationManager *locationManager;

@end

Expand All @@ -18,6 +20,22 @@ - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

// from http://blog.scottlogic.com/2014/03/19/simulator-enhancements.html

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
// Check for iOS 8. Without this guard the code will crash with "unknown selector" on iOS 7.
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
}

// Location Manager Delegate Methods
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"%@", [locations lastObject]);
}

- (void)didReceiveMemoryWarning
Expand Down
4 changes: 3 additions & 1 deletion Maps/Maps-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This lets the test app set location with xcode.</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.blackpixel.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Loading