0

I work on a project that was developed by other person, so I don't exactly know how he proceed. Anyway...

I have to had a new fonctionnality in Swift in Objc based project. So I add bridging header. All project work, except for one thing.

I have this class AGZClient.m (just part of)

@implementation AGZClient

+ (AGZClient *)sharedAGZClient
{
    static AGZClient *_sharedAGZClient = nil;

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedAGZClient = [[self alloc] initWithBaseURL:[NSURL URLWithString:agendizeURLString]];
    });

    return _sharedAGZClient;
}

- (instancetype)initWithBaseURL:(NSURL *)url
{
    self = [super initWithBaseURL:url];

    if (self) {
        self.responseSerializer = [AFJSONResponseSerializer serializer];
        self.requestSerializer = [AFJSONRequestSerializer serializer];
        //self.requestSerializer.timeoutInterval = 10.0;
        self.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", @"application/json", nil];
    }

    return self;
}

with AGZClient.h (part of also)

@protocol AGZClientDelegate;

@interface AGZClient : AFHTTPSessionManager
@property (nonatomic, weak) id<AGZClientDelegate>delegate;

+ (AGZClient *)sharedAGZClient;
- (instancetype)initWithBaseURL:(NSURL *)url;

The problem is that I'm unable to access to this class in Swift code (but it work in previous objc code). And yes, my class is in my bridging-header.h

#import "AGZClient.h"

And bridging header is in the build settings.

When I try to do

var client = AGZClient.sharedAGZClient()

I have

use of unresolved identifier "AGZClient"

I try with other classes but it works. I have absolutely no idea of what is the problem...

MaxL
  • 1
  • It looks like you haven't missed anything. Have you tried to build the code regardless of the error message. Sometimes Xcode doesn't refresh its state until next build. – Adam Jan 07 '16 at 10:53
  • seems swift header search path didn't include AGZClient.h directory – SolaWing Jan 07 '16 at 11:04
  • I try with an other in the same path and it works, and I try to build many times with other import. But always the same error. – MaxL Jan 07 '16 at 13:18
  • Clean, Clean Build Folder, and delete Derived Data. Then try to build. – wmcbain Jan 07 '16 at 15:11
  • Done... But no, always the same error. – MaxL Jan 08 '16 at 08:23

0 Answers0