CommonCrypto ライブラリを使用するアプリを開発しています。問題は、Swift ファイルでインスタンスを作成できることです。私のオブジェクトは Objective-C を使用して作成されました。ブリッジ ヘッダーをうまく作成できないようです。
エラーメッセージ
/Users/MNurdin/Documents/iOS/xxxxx/Models/Main.swift:15:9: 'CustomObject' does not have a member named 'encrypt'
CustomObject.h
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonCrypto.h>
#import "GTMBase64.h"
@interface CustomObject : NSObject
+ (NSString*)encrypt:(NSString*)plainText withKey:(NSString*)key;
@end
CustomObject.m
#import "CustomObject.h"
@implementation CustomObject
+ (NSString*)encrypt:(NSString*)plainText withKey:(NSString*)key{
/*--*/
return result;
}
@end
Global.swift
var instanceOfCustomObject: CustomObject = CustomObject()
println(instanceOfCustomObject.encrypt("p@$$w0rd","12345678"))