Git Product home page Git Product logo

sjnetwork's Introduction

Hi there 👋

  • 🔭 Working on:iOS & Java
  • 🌱 Focusing on:Coding & Reading & Investment
  • 📫 How to reach me:[email protected]
  • 🖊️ My Blog:https://knightsj.github.io/
  • 🖊️ WeChat official account(微信公众号):复利公社

sjnetwork's People

Contributors

knightsj avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sjnetwork's Issues

如何控制最大下载数?

目前想实现控制文件最大下载数,分析源码后目前有两个思路:

1.SJNetworkRequestEngine.m 第53行,通过这里设置

_sessionManager.operationQueue.maxConcurrentOperationCount = 5;

AFNetworking可以自行控制吗?还是会取消超过5个之外的请求?

2.SJNetworkRequestPool.h 第99行

-(NSInteger)currentRequestCount;
通过自己控制这个数量来实现

请问有更好的思路吗?

NSError object:Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set.

=========== NSError object:Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set., NSUnderlyingError=0x281e1d4d0 {Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: service unavailable (503)" UserInfo={NSLocalizedDescription=Request failed: service unavailable (503), NSErrorFailingURLKey=https://www.baidu.com, com.alamofire.serialization.response.error.data=<3c68746d 6c3e3c62 6f64793e 3c68313e 35303320 53657276 69636520 556e6176 61696c61 626c653c 2f68313e 0a4e6f20 73657276 65722069 73206176 61696c61 626c6520 746f2068 616e646c 65207468 69732072 65717565 73742e0a 3c2f626f 64793e3c 2f68746d 6c3e0a0a>, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x28106e8a0> { URL: https://www.baidu.com } { Status Code: 503, Headers {
"Cache-Control" = (
"no-cache"
);
Connection = (
close
);
"Content-Type" = (
"text/html"
);
} }}}}
=========== Status code:3840

怎么获取网络返回的原始json字符串?

有没有什么方法直接获取原始json字符串,没有转为responseObject之前的字符串。有些时候需要打印一下该字符串,比如responseObject为nil,但是返回成功,和后台联调接口的时候经常用到

怎么设置RequestSerializer呢?

后台请求的content-type只支持 text/html。但是你的RequestSerializer 设置成了 _sessionManager.requestSerializer = [AFJSONRequestSerializer serializer] 好像只能改源代码。。

另外还有个小建议就是 defailtParameters 和 addCustomHeader 能否用block的方式实时添加。比如用户请求 token 成功,之后的请求就都需要在请求头中添加 Authoraization=Bearer token 这种需求。现在好像只能在每个请求前手动添加(如果初始化时还未请求tokenaddCustomHeader未设置token的话)。

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.