[英]compatibility between GHUnit and AFNetWorking
嗨,我嘗試使用GHUnit創建單元測試,但我有一個例外,我認為這是AFNetWorking與GHUnit之間的兼容性問題
異常'GHTestFailureException',原因:'失敗' *首次拋出調用堆棧:(0x1de4012 0x163fe7e 0x1e6cfb1 0x2a4c1 0x2f20 0x137a4 0x191553f 0x1927014 0x19177d5 0x1d8aaf5 0x1d89f44 0x1d5ce 0e1x95e 0b
NSURL *url = [NSURL @"https://www.myWebsite.com"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:theRequest];
[operation setAuthenticationChallengeBlock:^(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge) {
NSURLCredential *newCredential = [NSURLCredential credentialWithUser:@"login" password:@"password" persistence:NSURLCredentialPersistenceForSession];
[challenge.sender useCredential:newCredential forAuthenticationChallenge:challenge];
}];
NSLog(@"Response from %@",response);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
GHFail(@"failed"); }];
[operation start];
[operation waitUntilFinished];
您可能需要四處尋找GHUnit異步測試。
例子:
https://gist.github.com/levigroker/1643797
http://vladimir.zardina.org/2010/11/testing-asynchronous-code-with-ghunit/ http://samwize.com/2012/11/25/create-async-test-with-ghunit/ http: // //samwize.com/2012/10/03/sentestingkit-does-not-support-wait-for-blocks/
關於AFNetworking
的問題,也有一個很大的話題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.