Search code examples
iosobjective-calassetlibrary

I am missing a step when writing code to retrieve IOS assetLibrary, but what am I missing?


Here is that part of my code:

//Filter photos
photoArray = [self getContentFrom:group withAssetFilter:[ALAssetsFilter allPhotos]];
//Enumerate through the group to get access to the photos.

[contentDictionary setObject:photoArray forKey:@"Photos"];

//Filter videos

videoArray = [self getContentFrom:group withAssetFilter:[ALAssetsFilter allVideos]];
[contentDictionary setObject:videoArray forKey:@"Videos"];

I assume its a simple solution. But i couldn't find the answer in Apple's objective-c handbook.

Some context info: I am adding a feature to my iPad program that lets users import media from the photos app. Here are the 4 errors below. Thanks

No visible @interface for 'ViewController' declares the selector 'getContentFrom:withAssetFilter:

No visible @interface for 'NSDictionary' declares the selector 'setObject:forKey:'

No visible @interface for 'ViewController' declares the selector 'getContentFrom:withAssetFilter:'

No visible @interface for 'NSDictionary' declares the selector 'setObject:forKey:'

And above each error it reads "ARC semantic issue".


Solution

  • The methods you're trying to call don't exist. If you want to add an object to a dictionary after initializing it you'll need to use an NSMutableDictionary instead.

    As for the other one, you are also trying to call getContentFrom:withAssetFilter: on your ViewController class. That method does not exist. You must have copy/pasted this code from somewhere and left out a piece. Nothing else anybody here can do for you since we have no idea what is supposed to be inside this method.