Git Product home page Git Product logo

weiboengine's Introduction

WeiboKit 是基于 AFNetworking 做的微博 SDK,OAuth 2.0+ARC. 跟多信息详见 README.


新浪微博 SDK,支持 OAuth 2.0 认证,支持 ARC。基于官方 SDK SinaWeiBoSDK2 修改,WBRequest 直接使用了官方封装,不支持 ARC,在 ARC 下要添加 -fno-objc-arc flag.

使用

  1. WBEngine.m 修改设置 appKey, appSecret, redirectURL. redirectURL 必须和微博应用设置的授权回调页一致。

  2. Code

    [[WBEngine sharedWBEngine] setDelegate:self];
    if ([[WBEngine sharedWBEngine] isLoggedIn]) {
        [[WBEngine sharedWBEngine] loggedInUserInfo];
    } else {
        [[WBEngine sharedWBEngine] logIn];
    }
  3. 实现 delegate:

    #pragma mark - WBEngineDelegate
    - (void)engineDidLogIn
    {
        //login success
    }
    
    - (void)engineDidFailLogInWithError:(NSError *)error
    {
        //login failed.
    }
    
    - (void)engineRequest:(WBRequestType)type didSucceedWithResult:(id)result
    {
        if (WBRequestTypeUsersShow == type) {
            if (result && [result isKindOfClass:[NSDictionary class]]) {
                //...
            }
        }
    }
    
    - (void)engineRequest:(WBRequestType)type didFailWithError:(NSError *)error
    {
        DLog(@"requestType:%d, error: %@", type, [error description]);
    }

weiboengine's People

Contributors

fannheyward avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.