Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get data from file stored in asset catalog

Tags:

xcode

ios

I am storing several .svg files in an asset catalog. To retrieve an asset I use the following code:

 NSDataAsset *asset = [[NSDataAsset alloc] initWithName:@"p"];

When running this code I get the following log message:

CoreUI: attempting to lookup a named data 'p' with a type that is not a data type in the AssertCatalog

The name of the file is 'p.svg' which is stored in a folder with 'dataset' as extension. I tried using other extensions for the file but nothing works. I always get the same error and the asset is nil.

like image 459
Rough Pilot Avatar asked Oct 02 '15 10:10

Rough Pilot


1 Answers

This may be related to a problem I'm having, in that the UTI I'm identifying my assets as being could run up the UTI dependancies and find public.image, thus making CoreUI think the asset is an image type and not a data type.

SVGs inherit from public.image, so you will need to set the File Type to something that doesn't inherit from public.image. Having it be just public.data will suffice.

what you need to change

like image 171
MaddTheSane Avatar answered Oct 14 '22 05:10

MaddTheSane