Skip to content

Commit eea0dde

Browse files
Amit PalomoAmit Palomo
Amit Palomo
authored and
Amit Palomo
committed
Improved HTTP error handling. Added Swift Sample project.
1 parent 8a48cbd commit eea0dde

File tree

35 files changed

+2110
-53
lines changed

35 files changed

+2110
-53
lines changed

Framework/IngeoSDK.framework/Versions/A/Headers/IGRegionTrigger.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// Copyright (c) 2015 Ingeo. All rights reserved.
77
//
88

9-
#import <IngeoSDK/IngeoSDK.h>
9+
#import "IGTrigger.h"
10+
#import <CoreLocation/CLLocation.h>
1011

1112
typedef NS_ENUM(NSInteger, IGRegionEvents) {
1213
IGRegionEventEntry = 1 << 0,
-1.16 KB
Binary file not shown.
Binary file not shown.

IngeoSDK.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
Pod::Spec.new do |s|
33
s.name = "IngeoSDK"
4-
s.version = "1.2.0"
4+
s.version = "1.2.1"
55
s.summary = "Ingeo iOS SDK"
66
s.homepage = "http://ingeo.io"
77
s.license = 'Apache License, Version 2.0'
88
s.author = { "Amit Palomo" => "[email protected]" }
99
s.platform = :ios, '7.0'
1010
s.source = { :git => "https://github.com/IngeoSDK/ingeo-ios-sdk.git", :tag => "v#{s.version}" }
11-
s.frameworks = "CoreLocation", "CoreData"
11+
s.frameworks = "CoreLocation", "CoreData", "SystemConfiguration"
1212
s.ios.vendored_frameworks = 'Framework/IngeoSDK.framework'
1313
s.requires_arc = true
1414
end

README.md

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
IngeoSDK is a power-efficient location library for iOS. It powers your app with
66
an always-on location tracking. It uses unique algorithms to dynamically adjust GPS power according to user
77
behaviour and whereabouts. Built to support iOS7 , iOS8 and iOS9, your app will
8-
get the most relevant streams of location data while in foreground or background - even when disconnected. Battery consumption is just 2% per hour. We think that location monitoring should be simple and just-work, so you focus on building your app.
8+
get the most relevant streams of location data while in foreground or background - even when network is disconnected. Battery consumption is just 1% per hour. Location tracking should be automatic and just-work, so you can focus on building your app.
99

1010
For a full list of features visit: http://ingeo.io/sdk
1111

1212
## Demo, please?
1313
1. [Download](https://github.com/IngeoSDK/ingeo-ios-sdk/archive/master.zip) as zip file or clone this repository.
14-
2. Unzip and open the project file in ***Samples/IngeoSDK-iOS-Sample01*** directory using Xcode.
15-
3. Edit *ViewController.m* to enter your API key in the SDK initializer method (line 26):
16-
```objc
17-
[IGLocationManager initWithDelegate:self secretAPIKey:@"APIKEYGOESHERE"];
14+
2. Unzip and open the project file in ***Samples/Swift-Sample01*** directory using Xcode.
15+
3. Edit *ViewController.swift* to enter your API key in the initializer method:
16+
```swift
17+
IGLocationManager.initWithDelegate(self, secretAPIKey: "APIKEYGOESHERE")
1818
```
1919
2020
To get a new API key, [Signup](http://admin.ingeo.io/signup.php) for free.
@@ -42,6 +42,7 @@ For a full list of features visit: http://ingeo.io/sdk
4242
bindings and will not increase your app size):
4343
*CoreLocation*
4444
*CoreData*
45+
*SystemConfiguration*
4546

4647
4. Linker Settings
4748
In Xcode, Go to 'Build Settings' -> 'Linking' -> 'Other Linker Flags'.
@@ -52,45 +53,65 @@ For a full list of features visit: http://ingeo.io/sdk
5253
1. In Xcode, Go to your target settings -> 'Capabilities' -> 'Background Modes'
5354
Turn on 'Location updates'.
5455

55-
2. Edit your app's Info.plist and add the following String key:
56+
2. Edit your app's Info.plist and add the following String key (with empty value):
57+
```
5658
NSLocationAlwaysUsageDescription
59+
```
5760

5861
## Usage
5962

60-
1. Import and set your delegate
63+
1. Import IngeoSDK in your *Bridging Header like so:
6164
```objc
6265
#import <IngeoSDK/IngeoSDK.h>
66+
```
67+
*[More info on bridging headers](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html)
6368

64-
@interface ViewController () <IGLocationManagerDelegate>
69+
2. Set Delegate
70+
```swift
71+
class ViewController: UIViewController, IGLocationManagerDelegate {
6572
```
6673

6774
2. Initialize
68-
```objc
69-
[IGLocationManager initWithDelegate:self secretAPIKey:@"APIKEYGOESHERE"];
75+
```swift
76+
IGLocationManager.initWithDelegate(self, secretAPIKey: "APIKEYGOESHERE")
7077
```
7178

7279
3. Start Location Monitoring
73-
```objc
74-
[IGLocationManager startUpdatingLocation];
80+
```swift
81+
IGLocationManager.startUpdatingLocation()
7582
```
7683

7784
4. Get tha honey
78-
Override IGLocationManagerDelegate methods in your delegate:
79-
```objc
80-
- (void)igLocationManager:(IGLocationManager *)manager didUpdateLocation:(IGLocation *)igLocation {
81-
NSLog(@"didUpdateLocation: %@", [igLocation description]);
82-
}
85+
Implement IGLocationManagerDelegate methods in your delegate.
8386

84-
- (void)igLocationManager:(IGLocationManager *)manager didDetectMotionState:(IGMotionState)motionState {
85-
NSLog(@"didDetectMotionState: %@",[IGLocation stringForMotionState:motionState]);
86-
}
87-
```
87+
Swift:
88+
89+
```swift
90+
func igLocationManager(manager: IGLocationManager!, didUpdateLocation igLocation: IGLocation!) {
91+
print("didUpdateLocation: \(igLocation.description)")
92+
}
93+
94+
func igLocationManager(manager: IGLocationManager!, didDetectMotionState motionState: IGMotionState) {
95+
print("didDetectMotionState: \(IGLocation.stringForMotionState(motionState))")
96+
}
97+
```
98+
99+
Objective-C:
100+
```objc
101+
- (void)igLocationManager:(IGLocationManager *)manager didUpdateLocation:(IGLocation *)igLocation {
102+
NSLog(@"didUpdateLocation: %@", [igLocation description]);
103+
}
104+
105+
- (void)igLocationManager:(IGLocationManager *)manager didDetectMotionState:(IGMotionState)motionState {
106+
NSLog(@"didDetectMotionState: %@",[IGLocation stringForMotionState:motionState]);
107+
}
108+
```
88109

89110
5. That's it. you've just enabled constant location monitoring.
90111
You may also login to http://admin.ingeo.io to access the analytics dashboard.
91112

92113
## API Documentation
93-
Full API reference (appledoc): http://ingeo.io/sdk/docs
114+
Full API reference (jazzy): http://ingeo.io/sdk/docs
94115

95116
## License
96117
Apache v2.0

Samples/IngeoSDK-iOS-Sample01/iOS-Sample01/Images.xcassets/LaunchImage.launchimage/Contents.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

Samples/IngeoSDK-iOS-Sample01/iOS-Sample01/Base.lproj/LaunchScreen.xib renamed to Samples/Objc-Sample01/iOS-Sample01/Base.lproj/LaunchScreen.xib

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
56
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
67
</dependencies>
78
<objects>
@@ -13,17 +14,20 @@
1314
<subviews>
1415
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2014 Ingeo. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
1516
<rect key="frame" x="20" y="439" width="441" height="21"/>
17+
<animations/>
1618
<fontDescription key="fontDescription" type="system" pointSize="17"/>
17-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
1820
<nil key="highlightedColor"/>
1921
</label>
2022
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOS-Sample01" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
2123
<rect key="frame" x="20" y="140" width="441" height="43"/>
24+
<animations/>
2225
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
23-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
26+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
2427
<nil key="highlightedColor"/>
2528
</label>
2629
</subviews>
30+
<animations/>
2731
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
2832
<constraints>
2933
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"images" : [
3+
4+
],
5+
"info" : {
6+
"version" : 1,
7+
"author" : "xcode"
8+
}
9+
}

Samples/IngeoSDK-iOS-Sample01/iOS-Sample01/ViewController.m renamed to Samples/Objc-Sample01/iOS-Sample01/ViewController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ @implementation ViewController
2020

2121
- (void)viewDidLoad {
2222
[super viewDidLoad];
23-
[self deployMap];
23+
[self mapSetup];
2424

25-
#error Please use your app secret API key. get it from http://ingeo.io.
25+
#error Please use your app secret API key. get it at http://ingeo.io/signup.php
2626
[IGLocationManager initWithDelegate:self secretAPIKey:@"APIKEYGOESHERE"];
2727

2828
[IGLocationManager startUpdatingLocation];
2929

3030
}
3131

32-
- (void)deployMap
32+
- (void)mapSetup
3333
{
3434
_mapView = [[MKMapView alloc] initWithFrame:self.view.frame];
3535
_mapView.showsUserLocation = YES;

0 commit comments

Comments
 (0)