Latest 0.0.4
Homepage https://github.com/anumshk27/TPLLBA
License MIT
MIT License
Copyright (c) 2017 TPLMaps
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Platforms ios 9.0, requires ARC
Authors

Getting Started

Before you can begin working with TPLLBA on iOS, you need to download the TPLLBA SDK for iOS.

Step 1: Get the latest version of Xcode

To build a project using the TPLLBA SDK for iOS, you need version 9.0 or later of Xcode.

Step 2: Install the SDK

TPLLBA SDK for iOS is available as a CocoaPods pod. CocoaPods is an open source dependency manager for Swift and Objective-C Cocoa projects.

If you don’t already have the CocoaPods tool, install it on macOS by running the following command from the terminal. For details, see the CocoaPods Getting Started guide.

sudo gem install cocoapods

Create a Podfile for the TPLLBA SDK for iOS and use it to install the API and its dependencies:

  1. If you don’t have an Xcode project yet, create one now and save it to your local machine. (If you’re new to iOS development, create a Single View Application.)

  2. Create a file named Podfile in your project directory. This file defines your project’s dependencies.

  3. Edit the Podfile and add your dependencies. Here is an example which includes the dependencies you need for the TPLLBA SDK for iOS:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'YOUR_APPLICATION_TARGET_NAME_HERE' do
pod 'TPLLBA'
end
  1. Save the Podfile

  2. Open a terminal and go to the directory containing the Podfile:

    cd <path-to-project>
  3. Run the pod install command. This will install the APIs specified in the Podfile, along with any dependencies they may have.

  4. Close Xcode, and then open (double-click) your project’s .xcworkspace file to launch Xcode. From this time onwards, you must use the .xcworkspace file to open the project.

Step 3: Implementation

The code below demonstrates how to start engine of TPLLBA in application.

Now, Update a few methods inside your app’s AppDelegate class.


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // Override point for customization after application launch.

        LBAds.shared().initializeAdsWithAppId("APP_ID")

        return true
    }

Set APNS Token to send the push notifications


    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

        // Convert token to string
        let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
        LBAds.shared().setAPNSToken(deviceTokenString)

    }

Stop background service


    func applicationDidEnterBackground(_ application: UIApplication) {
        LBAds.shared().applicationDidEnterBackground()
    }

Start service on application becomes active


    func applicationDidBecomeActive(_ application: UIApplication) {
        LBAds.shared().applicationWillEnterForeground()
    }

Below iOS 10 support

Add following code to show the ads notifications


    func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
        LBAds.shared().notificationTapped(notification)
    }

Important notes

Following settings are required for propely working sdk

  1. App Transport Security Settings : Allow Arbitrary Loads : YES
  2. Privacy – Location Always Usage Description : [Message to Display User]
  3. Privacy – Location Always and When In Use Usage Description : [Message to Display User]
  4. Privacy – Location When In Use Usage Description : [Message to Display User]

In Capabilities:

  1. Enable Background Modes for Location Updates and Background Fetch
  2. Turn On Remote Notifications
For Objective-C : Goto Build Settings -> Always Embed Swift Standard Libraries = YES

Latest podspec

{
    "name": "TPLLBA",
    "version": "0.0.4",
    "summary": "Location based ads by TPLMaps Ltd.",
    "description": "A product of TPLMaps Ltd. Provide ads according to user location. Using TPLLBA an app can capture the desire audience and business will be expanded.",
    "homepage": "https://github.com/anumshk27/TPLLBA",
    "license": {
        "type": "MIT",
        "text": "nMIT LicensenCopyright (c) 2017 TPLMapsnPermission is hereby granted, free of charge, to any person obtaining a copynof this software and associated documentation files (the "Software"), to dealnin the Software without restriction, including without limitation the rightsnto use, copy, modify, merge, publish, distribute, sublicense, and/or sellncopies of the Software, and to permit persons to whom the Software isnfurnished to do so, subject to the following conditions:nThe above copyright notice and this permission notice shall be included in allncopies or substantial portions of the Software.nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORnIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEnAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERnLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THEnSOFTWARE.n"
    },
    "authors": {
        "TPLMaps": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/anumshk27/TPLLBA.git",
        "tag": "0.0.4"
    },
    "ios": {
        "vendored_frameworks": "TPLLBA.framework",
        "frameworks": [
            "UIKit",
            "CoreLocation",
            "SystemConfiguration",
            "CFNetwork"
        ]
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This