2

cocoapods で構築された Xcode プロジェクトがあります。Objective C コードのみが含まれています。コア Spotlight フレームワークを統合して、アプリにネイティブ検索機能を提供したいと考えていました。アプリは、すべての Networking 呼び出しに AFNetworking を使用します。ただし、http プロトコルを使用してサーバーに接続すると、現在このエラーが発生しています。

"desc __NSCFConstantString * @"App Transport Security ポリシーで安全な接続を使用する必要があるため、リソースを読み込めませんでした。" 0x04d9d6ac

サーバー側に HTTPS プロトコルを実装していないので、今のところ http だけです。同じコードベースは、Xcode 6.x および iOS 8.3 SDK で完全に機能します。理由は何ですか?他の誰かが同様の問題に直面していますか?

以下は、私のアプリのコード スニペットです。

 NSMutableURLRequest *request = [serializer requestWithMethod:@"GET" URLString:url parameters:parameters error:nil];

AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request];


[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    [RESTSessionManager sharedSession:profile];
    NSDictionary *json =
    [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
    NSMutableArray* entries = json[@"entries"];
    NSDictionary *content = [entries[0] objectForKey:@"content"];
    NSDictionary *properties = [content objectForKey:@"properties"];
    profile.repoUserName=  [properties objectForKey:@"user_name"];
    success(operation, responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSString *desc = [[error userInfo] objectForKey:@"NSLocalizedDescription"];

    if( [desc isEqual:@"The network connection was lost."] || [desc isEqual:@"Could not connect to the server."] || [desc isEqual:@"The request timed out."])
        offline();
    else
        failure(operation, error);
}];
4

0 に答える 0