user842225
user842225

Reputation: 5979

swift raise unresolved identifier

I am using 3rd party external framework in my objective-c project. I created an swift file in this project to use the framework.

In MyModule-Bridging-Header.h I have import external framework header

#import “ext-service/ext-service.h”

In the ext-service.h there is an constant:

typedef NS_ENUM(NSInteger, service_err_t) {
    SERVICE_SUCCESS = 1
}

In my swift code

//Compiler error: use of unresolved identifier ‘SERVICE_SUCCESS’
if result == SERVICE_SUCCESS{
     NSLog(“successful!”)
}

But I get compiler error:

use of unresolved identifier ‘SERVICE_SUCCESS’

Why?

Upvotes: 1

Views: 735

Answers (1)

Vivek Molkar
Vivek Molkar

Reputation: 3960

The reason to the error you mentioned is SERVICE_SUCESS is unavailable(unknown).

There are 2 possible solutions:

  1. Use service_err_t.SERVICE_SUCCESS instead of SERVICE_SUCESS
  2. result is of type service_err_t then just using .SERVICE_SUCESS

Hope this helps!

Upvotes: 3

Related Questions