Reputation: 1379
My code looks as below in my source code:
+ (ALAssetsLibrary *)defaultAssetsLibrary {
static dispatch_once_t pred = 0;
static ALAssetsLibrary *library = nil;
dispatch_once(&pred, ^{
library = [[ALAssetsLibrary alloc] init];
});
return library;
}
When I try to build, it gives error as :
"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
objc-class-ref in Setting_Main.o //Setting_Main.o reflects name of my source file Setting_Main.h
ld: symbol(s) not found for architecture i386
Now, when I comment some line as below, it does not show error. However, I am not able to get value of library.
+ (ALAssetsLibrary *)defaultAssetsLibrary {
static dispatch_once_t pred = 0;
static ALAssetsLibrary *library = nil;
//dispatch_once(&pred, ^{
//library = [[ALAssetsLibrary alloc] init];
// });
return library;
}
Can anyone suggest me what is exactly going wrong here?
Upvotes: 0
Views: 118
Reputation: 1379
I just got it. The error was simply because the AssestsLibrary.framework was also present in my downloads and the program was pointing to that location by default. So, I deleted the framework at downloads and it worked.
Upvotes: 0
Reputation: 1138
Have you added the AssetsLibrary framework to the “Link Binary With Libraries” build phase of your target? Sounds exactly like a similar problem i had a couple of weeks ago that had to do with that.
Upvotes: 1
Reputation: 20993
This is linker error, you need to add the assets library
/System/Library/Frameworks/AssetsLibrary.framework
framework to your project.
Upvotes: 2