Latest1.0.0
Homepagehttps://github.com/mourke/LastFMKit
LicenseMIT MIT License

Copyright (c) 2017 Mark Bourke

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.

Platformsios 8.0, osx 10.10, watchos 2.0, tvos 9.0, requires ARC
Authors

Objective-C wrapper for Last.fm API

Travis
Carthage compatible CocoaPods compatible Swift 3.0.x Platforms License

Installation with CocoaPods

Install cocoapods with the following command:

$ gem install cocoapods

Podfile

To integrate LastFMKit into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'LastFMKit', '~> 1.0'
end

Then, run the following command:

$ pod install

Installation with Carthage

Install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

Cartfile

To integrate LastFMKit into your Xcode project using Carthage, specify it in your Cartfile:

github "mourke/LastFMKit"  ~> 1.0

Run carthage to build the framework and drag the built LastFMKit.framework into your Xcode project.

Usage

Setting Your API Information

The API information must be set every time the application starts. If you do not do this, an exception will be raised on any attempt to make calls to the wrapper. The best place to do this is inside the application:didFinishLaunchingWithOptions: function in your AppDelegate.m file:

Objective-C:

[[LFMAuth sharedInstance] setApiKey:@"YOUR_API_KEY"];
[[LFMAuth sharedInstance] setApiSecret:@"YOUR_API_SECRET"];

Swift:

Auth.shared().apiKey = "YOUR_API_KEY"
Auth.shared().apiSecret = "YOUR_API_SECRET"

Authenticating with Last.fm

Authentication need only be done once, but is required to make any authenticated calls to the API. The LFMSession object will be stored in the user’s keychain and loaded on subsequent app launches.

Objective-C:

LFMAuth *sharedInstance = [LFMAuth sharedInstance];

if (!sharedInstance.userHasAuthenticated) {
  [sharedInstance getSessionWithUsername:@"USERNAME" password:@"PASSWORD" callback:^(NSError * _Nullable error, LFMSession * _Nullable session) {
      if (error != nil) {
        // Handle error
      } else {
        // Success
      }
  }];
}

Swift:

let shared = Auth.shared()

if !shared.userHasAuthenticated {
  shared.getSession(username: "USERNAME", password: "PASSWORD") { (error, session) in
    if let session = session {
      // Success
    } else if let error = error {
      // Handle error
    }
  }
}

License

LastFMKit is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "LastFMKit",
    "version": "1.0.0",
    "summary": "Objective-C bindings for the Last.FM API",
    "homepage": "https://github.com/mourke/LastFMKit",
    "license": {
        "type": "MIT",
        "text": "    MIT Licensenn    Copyright (c) 2017 Mark Bourkenn    Permission is hereby granted, free of charge, to any person obtaining a copyn    of this software and associated documentation files (the "Software"), to dealn    in the Software without restriction, including without limitation the rightsn    to use, copy, modify, merge, publish, distribute, sublicense, and/or selln    copies of the Software, and to permit persons to whom the Software isn    furnished to do so, subject to the following conditions:nn    The above copyright notice and this permission notice shall be included in alln    copies or substantial portions of the Software.nn    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORn    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEn    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERn    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THEn    SOFTWARE.nn"
    },
    "authors": {
        "Mark Bourke": "[email protected]"
    },
    "requires_arc": true,
    "source": {
        "http": "https://github.com/mourke/LastFMKit/releases/download/1.0.0/LastFMKit.framework.zip"
    },
    "ios": {
        "vendored_frameworks": "Carthage/Build/iOS/LastFMKit.framework",
        "source_files": "Carthage/Build/iOS/LastFMKit.framework/Headers/*.h",
        "public_header_files": "Carthage/Build/iOS/LastFMKit.framework/Headers/*.h"
    },
    "tvos": {
        "vendored_frameworks": "Carthage/Build/tvOS/LastFMKit.framework",
        "source_files": "Carthage/Build/tvOS/LastFMKit.framework/Headers/*.h",
        "public_header_files": "Carthage/Build/tvOS/LastFMKit.framework/Headers/*.h"
    },
    "osx": {
        "vendored_frameworks": "Carthage/Build/Mac/LastFMKit.framework",
        "source_files": "Carthage/Build/Mac/LastFMKit.framework/Versions/A/Headers/*.h",
        "public_header_files": "Carthage/Build/Mac/LastFMKit.framework/Versions/A/Headers/*.h"
    },
    "watchos": {
        "vendored_frameworks": "Carthage/Build/watchOS/LastFMKit.framework",
        "source_files": "Carthage/Build/watchOS/LastFMKit.framework/Headers/*.h",
        "public_header_files": "Carthage/Build/watchOS/LastFMKit.framework/Headers/*.h"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "watchos": "2.0",
        "tvos": "9.0"
    }
}

Pin It on Pinterest

Share This