• MKNetworkKit介绍和使用


    转自:http://blog.mugunthkumar.com/ios-components/mknetworkkit/

    MKNetworkKit is an easily one of the most popular and powerful networking frameworks available for iOS.
    It’s a open source component that’s actively maintained by me (and thanks for various other contributors).

    Using MKNetworkKit

    If you are using git, you can add MKNetworkKit as a submodule. Fire up your terminal and type

    git submodule add git@

    https://github.com/MugunthKumar/MKNetworkKit

    Once the repository is downloaded, open it in Finder. Locate the directory MKNetworkKit and drag and drop it to your project. If you are building for iOS, remove the files NSAlertView+MKNetworkKitAdditions.h/m. Alternatively, if you are building for Mac, remove the files UIAlertView+MKNetworkKitAdditions.h/m. This is illustrated in the screenshot below.

     

     

     

     

     

    Click the “Remove References” button to remove these two files from the project. The next step is to add the two system frameworks needed by MKNetworkKit. Open the “Build Phases” section of your target and link it against Security.Framework and SystemConfiguration.Framework.

    You are good to go. Try a Build and Run.

    Architecture

    The complete functionality of MKNetworkKit centers around two classes, MKNetworkEngine and MKNetworkOperation. Can you imagine that? It’s that simple.
    MKNetworkEngine is a class that models your …

    /*

    做一个简单的GET请求

    制作一个POST请求

    多部分表单数据上传

    认证

    基本的

    消化

    Windows NTLM身份

    缓存你的反应

    自定义缓存行为
    作为图像缓存替代使用MKNetworkKit

    通过子类的功能更强大的定制

    发牌

    MKNetworkKit使用麻省理工学院授权这意味着,你应该归功于我在你的关于屏幕。一个简单的一行文本

    */

    Making a simple GET request

    Making a POST request

    Multi-part form data upload

    Authentication

    Basic

    Digest

    Windows NTLM

    Caching your responses

    Customizing the cache behavior
    Using MKNetworkKit as a Image Cache alternative.

    More powerful customization through subclassing

    Licensing

    MKNetworkKit uses MIT Licensing. This means, you should attribute me in your About screen. A simple one line text

    “This product uses MKNetworkKit by Mugunth Kumar”

    in your product’s about page will suffice.

    Attribution Free Licensing

    If you work for a client and the client wants you to get an attribution-free license, or that you just want to support my effort, head on to the license store.

    Third party featured posts

    • Uploading an image using MKNetworkKit is a cakewalk. Follow this tutorial by Mike over at Go Feisty! blog to understand how to use MKNetworkKit to upload images.
    • Manbolo games have been using plain NSURLConnection/NSMutableURLRequest for making network operations in their app. They switched to MKNetworkKit and are happy. You can read about it here.
    • Cocoa Manifest covered about MKNetworkKit here.

    You can find various other blog posts featuring MKNetworkKit. If you wrote one, let me know. I’ll feature it here.

  • 相关阅读:
    114自定义UITableViewCell(扩展知识:为UITableViewCell添加动画效果)
    101在检索框中添加一个书签按钮(扩展知识:在检索框中添加一个范围条)
    088实现自动倒计时功能
    086设置日期选择器框的显示样式
    Shell if else
    Shell数组
    Shell字符串
    Shell运算符
    数据挖掘标准流程规范
    Shell转义字符与变量替换
  • 原文地址:https://www.cnblogs.com/jiangshiyong/p/2549588.html
Copyright © 2020-2023  润新知