Giter Site home page Giter Site logo

bbookman / snapchat-snap-kit-demo-here Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 28 KB

iOS App in Swift uses Here Geolocation to make a map that can be added to a snap in Snapchat

Swift 94.62% Ruby 5.38%
swift ios snapchat snapkit photo video location geolocation here map

snapchat-snap-kit-demo-here's Introduction

Snapchat Snap Kit Mapping GPS/Location Sticker using Here SDK

iOS App in Swift uses Here Geolocation to make a map sticker that can be added to a snap in Snapchat

Inspired by Location-aware Snapchat stickers with Snap Kit + HERE

Instructions

You can find great instructions in the post Location-aware Snapchat stickers with Snap Kit + HERE, or follow along below - or do both

Note: If following the instructions in the Here post, an easy to miss detail is using the JavaScript/REST activation rather than the iOS SDK. Use JavaScript/REST

Snapchat Developer Portal

  1. Sign up for an account on the Snapchat Dev Portal
  2. Note / copy the value in Development App Info > OAUTH2 CLIENT ID

Get Snapchat Snap Kit using Cocoapods

The Podfile in this repository already contains what is required. See this Snapchat doc. Just run pod install

Info.plist

Edit the Info.plist and add or modify as described below:

Don't forget to remove all of the comments in the info.plist

    <key>SCSDKClientId</key>
    <string><OAUTH2 CLIENT ID></string> // See the step above in Snapchat Developer Protal

The SCSDKRedirectUrl and the CFBundleURLSchemes are related, as well as the value to place in the Snapchat Developer Portal.

The values can be completely made up. As long as the values match and are unique (see below). For example, if my app is named This Crazy App I could set these values:

  1. In the Snap Kit Portal, add at least one url to Redirect URLs, in the example this would be thiscrazyapp://myapp
  2. Add the CFBundleURLSchemes in the info.plist, in the example this would be thiscrazyapp
  3. Add the SCSDKRedirectUrl in th info.plist, in the example this would be thiscrazyapp://myapp

For more information, see Snapchat Snapkit DIY Docs

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>snapchat</string> //add this
    </array>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>thiscrazyapp</string> //Should be unique to your app
            </array>
            <key>CFBundleURLName</key>
            <string></string>
        </dict>
    </array>
    <key>SCSDKRedirectUrl</key>
        <string>thiscrazyapp://myapp</string> //must match what you add in snapchat dev portal

Set user option for allow location

<key>NSLocationWhenInUseUsageDescription</key>
    <string>Location will only be used when app is open</string>
    <key>NSLocationUsageDescription</key>
    <string>Location is used to create location relevant stickers</string>

The info.plist in this repository is complete and only requires the unique values from your Snap Kit Developer Portal values:

  • OAUTH2 CLIENT ID (Development)
  • Redirect URLs

Sign up for Here SDK

Simple. Go to developer.here.com and get a free account. When you get to the point of choosing your SDK, choose JavaScript/REST

Make note of the App ID and the App Code that are displayed after activation.

In the ViewController.swift file, you will see the code below. Replace

func createMapImage() -> UIImage {
        struct here {
            static var id = "YOUR-APP-ID"
            static var code = "YOUR-APP-CODE"
        }

Running the App

Run it on a physical phone so you can use the camera

Resources

If You Liked This Repository, you may also enjoy

Contact Me

snapchat-snap-kit-demo-here's People

Contributors

bbookman avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lmick002

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.