Giter Site home page Giter Site logo

ssbackgroundmode's Introduction

SSBackgroundMode

长时间后台运行的2种,audio session And background fetch

  • Audio Session 音频播放
  • Background fetch 后台请求
  • Location updates 更新定位
  • Voice over IP
  • Remote notification 带特定键值的推送通知

NSURLSessionConfiguration工作模式分为:
Default sessions - 默认类型,支持(disk-based cache)和(store credentials in the user’s keychain)
Ephemeral sessions - 此类型不会在硬盘中存储数据,所有的cache、credential stores等都保留在RAM中,当session失效时自动被清除
Background sessions - 和默认类型很相似,但是会采用单独的进程管理数据传输,实现后台允许

  • 在使用downloadTask时:
    如果是background模式使用-downloadTaskWithRequest completionHandler block回调会crash。使用-downloadTaskWithRequest ,配合delegate代替。 App在前台时也能使用后台模式

  • 在使用uploadTask时:
    如果是background模式只能使用-uploadTaskWithRequest:(NSURLRequest *)request fromData:(NSData *)bodyData;
    如果是default模式可以使用fromData 和 fromFile两种方式

ssbackgroundmode's People

Contributors

sun-dev2020 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.