I am using CocoaPods to install the Realm. Then now i need to write the test case for my function. The problem is the compile can't find the Realm/Realm.h. Below is my test case.
#import <XCTest/XCTest.h>
#import "Bookmark.h"
@interface BookmarkTest : XCTestCase
@end
@implementation BookmarkTest
{
Bookmark *bookmark;
}
- (void)setUp {
[super setUp];
bookmark = [[Bookmark alloc]init];
}
@end
Below is my Bookmark class
#import <Realm/Realm.h>
//error shown here:Realm/Realm.h file not found
RLM_ARRAY_TYPE(Bookmark)
@interface Bookmark : RLMObject
@property NSString *bId;
@property int type;
@property NSString *mallId;
@property NSString *storeId;
@property NSString *itemId;
@end
My podfile,
pod 'Realm'
pod 'Realm/Headers'
Thank you.
You have to specify your test target in your Podfile as well. CocoaPods in versions until 0.39 integrates by default only the first target in your project.
The subspec Realm/Headers
is only thought for test targets with static linking.
Given that your test target, assuming it is named MyAppTests
links already to your app target what it would usually wit the default setup, your Podfile should look like seen below:
target "MyApp" do
pod "Realm"
end
target "MyAppTests" do
pod "Realm/Test"
end