Skip to content

Commit

Permalink
Improved HTTP error handling. Added Swift Sample project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit Palomo authored and Amit Palomo committed Dec 16, 2015
1 parent 8a48cbd commit eea0dde
Show file tree
Hide file tree
Showing 35 changed files with 2,110 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// Copyright (c) 2015 Ingeo. All rights reserved.
//

#import <IngeoSDK/IngeoSDK.h>
#import "IGTrigger.h"
#import <CoreLocation/CLLocation.h>

typedef NS_ENUM(NSInteger, IGRegionEvents) {
IGRegionEventEntry = 1 << 0,
Expand Down
Binary file modified Framework/IngeoSDK.framework/Versions/A/IngeoSDK
Binary file not shown.
Binary file modified Framework/IngeoSDK.framework/Versions/A/Resources/Info.plist
Binary file not shown.
4 changes: 2 additions & 2 deletions IngeoSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

Pod::Spec.new do |s|
s.name = "IngeoSDK"
s.version = "1.2.0"
s.version = "1.2.1"
s.summary = "Ingeo iOS SDK"
s.homepage = "http://ingeo.io"
s.license = 'Apache License, Version 2.0'
s.author = { "Amit Palomo" => "amit@ingeo.io" }
s.platform = :ios, '7.0'
s.source = { :git => "https://github.com/IngeoSDK/ingeo-ios-sdk.git", :tag => "v#{s.version}" }
s.frameworks = "CoreLocation", "CoreData"
s.frameworks = "CoreLocation", "CoreData", "SystemConfiguration"
s.ios.vendored_frameworks = 'Framework/IngeoSDK.framework'
s.requires_arc = true
end
65 changes: 43 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
IngeoSDK is a power-efficient location library for iOS. It powers your app with
an always-on location tracking. It uses unique algorithms to dynamically adjust GPS power according to user
behaviour and whereabouts. Built to support iOS7 , iOS8 and iOS9, your app will
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.
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.

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

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

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

2. Edit your app's Info.plist and add the following String key:
2. Edit your app's Info.plist and add the following String key (with empty value):
```
NSLocationAlwaysUsageDescription
```

## Usage

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

@interface ViewController () <IGLocationManagerDelegate>
2. Set Delegate
```swift
class ViewController: UIViewController, IGLocationManagerDelegate {
```

2. Initialize
```objc
[IGLocationManager initWithDelegate:self secretAPIKey:@"APIKEYGOESHERE"];
```swift
IGLocationManager.initWithDelegate(self, secretAPIKey: "APIKEYGOESHERE")
```

3. Start Location Monitoring
```objc
[IGLocationManager startUpdatingLocation];
```swift
IGLocationManager.startUpdatingLocation()
```

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

- (void)igLocationManager:(IGLocationManager *)manager didDetectMotionState:(IGMotionState)motionState {
NSLog(@"didDetectMotionState: %@",[IGLocation stringForMotionState:motionState]);
}
```
Swift:

```swift
func igLocationManager(manager: IGLocationManager!, didUpdateLocation igLocation: IGLocation!) {
print("didUpdateLocation: \(igLocation.description)")
}

func igLocationManager(manager: IGLocationManager!, didDetectMotionState motionState: IGMotionState) {
print("didDetectMotionState: \(IGLocation.stringForMotionState(motionState))")
}
```

Objective-C:
```objc
- (void)igLocationManager:(IGLocationManager *)manager didUpdateLocation:(IGLocation *)igLocation {
NSLog(@"didUpdateLocation: %@", [igLocation description]);
}

- (void)igLocationManager:(IGLocationManager *)manager didDetectMotionState:(IGMotionState)motionState {
NSLog(@"didDetectMotionState: %@",[IGLocation stringForMotionState:motionState]);
}
```

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

## API Documentation
Full API reference (appledoc): http://ingeo.io/sdk/docs
Full API reference (jazzy): http://ingeo.io/sdk/docs

## License
Apache v2.0
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
<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">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
Expand All @@ -13,17 +14,20 @@
<subviews>
<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">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"images" : [

],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ @implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
[self deployMap];
[self mapSetup];

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

[IGLocationManager startUpdatingLocation];

}

- (void)deployMap
- (void)mapSetup
{
_mapView = [[MKMapView alloc] initWithFrame:self.view.frame];
_mapView.showsUserLocation = YES;
Expand Down
File renamed without changes.
Loading

0 comments on commit eea0dde

Please sign in to comment.