afnetworking

Property Has a Previous Declaration

与世无争的帅哥 提交于 2019-12-09 17:10:56
问题 I tried adding XMPP framework into my ios project and I couldn't get it working. Turns out I added it incorrectly, So I tried removing it and now without XMPP I am getting these errors: Thanks in Advance! 回答1: This could also happen because of CocoaPods . I had this issue with version cocoapods-0.39.0 , downgrading to cocoapods-0.38.2 fixed it for now. 回答2: You have two copies of AFNetworking in your project. Delete one of them. ...or better yet, use CocoaPods to integrate AFNetworking and

POST Request with AFNetworking 2.0 not working, but working in HTTP Request tester

浪子不回头ぞ 提交于 2019-12-09 13:38:05
问题 I've just started using the new AFNetworking 2.0 API having used the previous versions for a while now. I'm trying to do a bog standard http POST request , but sadly I'm not doing too well. This is my current code: AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager]; NSDictionary *parameters = @{@"username" : self.usernameField.text, @"password" : self.passwordField.text}; [operationManager POST:@"https:URL GOES HERE" parameters:parameters success:^

iOS开发之 -- CocoPods的安装和使用

一曲冷凌霜 提交于 2019-12-09 10:13:31
以前项目中使用过Pods 1.0,最近项目中也有用到,因为很长时间没用了,所以配置了下,谁知道,中间出现了不少坑,特记录在此博客,其实pods的使用也就是几个终端命令而已,可能随着系统的升级,以前的终端命令,会因为电脑里面配置了其他的环境,比如react native 等,会影响到pos的配置 安装过程如下: 1,打开终端,输入命令:" gem sources -l "来查看镜像是否被墙,如图(下面的镜像是我替换过以后的图像),注:这里输出如果是: https://rubygems.org/ 镜像的话,我们要删除这个镜像,然后添加镜像: https://ruby.taobao.org/ (已废弃), 具体操作如下 : <1>删除原始镜像: gem sources --remove https://rubygems.org/ <2>添加新的镜像: gem sources -a https://ruby.taobao.org/(已废弃),现在使用: https://gems.ruby-china.com <3>查看是否更改成功:在此输入命令,如下图:(就修改成功了) 3,接下来我们要进行安装pods的重要步骤了:( sudo gem install -n /usr/local/bin cocoapods ) 注意:在这个过程中,会出现一些错误,具体的错误可以自行百度

安装CocoaPods报错 - [!] The dependency `AFNetworking (~> 3.1.0)` is not used in any concrete target.

丶灬走出姿态 提交于 2019-12-09 10:11:56
今天新机装cocopods时,等安装完毕发觉出现[!] The dependency `AFNetworking (~> 3.1.0)` is not used in any concrete target.这个警告。看了下版本: 1.0.1 解决方式: 官网是这样给推荐的: 在创建Podfile的时候,用这种格式使用, platform :ios, '8.0' #use_frameworks!个别需要用到它,比如reactiveCocoa target 'TestPod' do pod 'AFNetworking', '~> 2.6' pod 'ORStackView', '~> 3.0' pod 'SwiftyJSON', '~> 2.3' end 里面的 TestPod 记得替换为自己工程里面的target。这样就基本OK了,执行pod install / pod update 就都可以了。(use_frameworks! 这个是个别需要的) 下面是另外一种写法, platform :ios, '8.0' #use_frameworks!个别需要用到它,比如reactiveCocoa def pods pod 'AFNetworking', '~> 2.6' pod 'ORStackView', '~> 3.0' pod 'SwiftyJSON', '~> 2.3' end

NSURLConnection - Disable the authentication challenge response mechanism

十年热恋 提交于 2019-12-09 09:44:26
问题 SITUATION Using AFNetworking (NSURLConnection) to access my server API The API needs Basic Authentication with token as username The API returns HTTP 401 when token is invalid I set the Basic Authentication headers before any request If it returns 401, I retry like this: AFHTTPRequestOperation *requestOperation = [MyHTTPClient.sharedClient HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { processSuccessBlock(operation, responseObject); }

AFNetworking 2.0 multipart request body blank

ε祈祈猫儿з 提交于 2019-12-09 06:52:30
问题 Similar to this issue. Using AFNetworking 2.0.3 and trying to upload an image using AFHTTPSessionManager's POST + constructingBodyWithBlock. For reasons unknown, it seems as though the HTTP post body is always blank when the request is made to the server. I subclass AFHTTPSessionManager below (hence the usage of [self POST ...] . I've tried constructing the request two ways. Method 1 : I just tried to pass params and then add only the image data should it exist. - (void) createNewAccount:

AFHTTPClient.m no longer in AFNetworking?

浪子不回头ぞ 提交于 2019-12-09 06:08:05
问题 I am following a tutorial (http://bit.ly/1dbLaPh) that uses AFNetworking. It says to make a new class that is subclassed from AFHTTPClient. This option does not appear in the SubClass Of" field. I checked the AFNetworking folder and there is no AFHTTPClient.m implementation file. Has this file been renamed to something else? thanks, 回答1: In AFNetworking 2.0 the AFHTTPClient has been replaced by AFHTTPRequestOperationManager / AFHTTPSessionManager. I would suggest you to refer the example. Git

AFNetworking won't compile

偶尔善良 提交于 2019-12-09 05:59:56
问题 I'm totally stuck trying to run a project on the simulator using AFNetworking. I've used this dependency before on other projects, so I don't understand what is going wrong here. First, the error when I try to run the project: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_AFHTTPSessionManager", referenced from: _OBJC_CLASS_$_SharedNetworkObject in SharedNetworkObject.o "_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from: objc-class-ref in SharedNetworkObject.o "_OBJC

Resetting basic authentication credentials with AFNetworking

早过忘川 提交于 2019-12-09 05:34:34
问题 I am writing a REST client (with AFNetworking) and need the ability to trigger the creation of a new session within a single instance of an application. In other words, I would like to: 1 - Authenticate with server 2 - Do some REST calls 3 - Simulate "Log out" 4 - Re-authenticate with server 5 - Do some more REST calls AFNetworking is great with making that initial authentication and REST calls, but I can't figure out how I would clear the session and "reset" the connection within the same

AFNetworking Background Session Configuration for iOS 8 Extension

纵然是瞬间 提交于 2019-12-09 05:25:58
问题 I'm currently developing an iOS 8 App Extension, and am having difficulty with this one last piece. In the rest of my app, I use an AFHTTPSessionManager subclass that I instantiate like this: + (MYAPIClient *)sharedClient { static MYAPIClient *_sharedClient = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _sharedClient = [[MYAPIClient alloc] initWithBaseURL:[NSURL URLWithString:kMYBaseURL]]; _sharedClient.requestSerializer = [[MYAPIRequestSerializer alloc] init];