Objective-c and Swift mixed project -Swift.h file report errors

107 Views Asked by At

I use SVN update the project, then my project report errors below:

enter image description here

My report errors code is here:

SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy)   NSString * _Nonnull Mob_App_Key;) // error:Expected an Objective-C directive after '@'
+ (NSString * _Nonnull)Mob_App_Key;
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy)   NSString * _Nonnull Mob_App_Secret;)
+ (NSString * _Nonnull)Mob_App_Secret;

But you see my defines of Mob_App_Key or Mob_App_Secret:

// 银行
static let 中国工商银行 = "中国工商银行"
static let 中国银行 = "中国银行"
static let 中国建设银行 = "中国建设银行"
static let 中国农业银行 = "中国农业银行"
static let 中国邮政银行 = "中国邮政银行"


/* app key */
// 1.Mob
static let Mob_App_Key = "18asd0easdas159b"
static let Mob_App_Secret = "f8asdsdasd25055eb5efd70c43a854"
// 2.Bugly
static let Bugly_App_Id = "fcasdads3"
static let Bugly_App_Secret = "f93b192d-rrrr-4ssss-b604-68bfc49b8f4e"

They are no different with Bugly_App_Id, and in the -Swift.h, Bugly_App_Id did not report error, I don't know where comes the errors.

I have restart Xcode, and clean my project, it is not work for me.

1

There are 1 best solutions below

0
On BEST ANSWER

I find out the error why appear:

My project in the SVN, deleted the AppDelegate.h and AppDelegate.m and main.m, and replaced with AppDelegate.swift, means replace Objective-C's AppDelegate to Swift's AppDelegate, but in my this macbook, the Objective-C's AppDelegate is still keep.

My Objective-C's AppDelegate is using Mob_App_Key and Mob_App_Secret.

So I delete my Objective-C's AppDelegate, the issues go away.