Difference between revisions of "ASAssetQuery"

From iPhone Development Wiki
Jump to: navigation, search
m (Changed code block to source.)
 
Line 3: Line 3:
 
Here is how we list all the dictionary assets on the iDevice
 
Here is how we list all the dictionary assets on the iDevice
  
<pre>
+
<source lang="logos">
 
ASAssetQuery * aq = [[%c(ASAssetQuery) alloc] initWithAssetType:@"com.apple.MobileAsset.DictionaryServices.dictionary2"];
 
ASAssetQuery * aq = [[%c(ASAssetQuery) alloc] initWithAssetType:@"com.apple.MobileAsset.DictionaryServices.dictionary2"];
 
NSError *err = nil;
 
NSError *err = nil;
Line 10: Line 10:
 
NSArray *results = [aq results];
 
NSArray *results = [aq results];
 
HBLogDebug(@"results = %@", results)
 
HBLogDebug(@"results = %@", results)
</pre>
+
</source>
 
Note: for a dictionary you can also use <code>DCSDictionaryAssetQuery</code>
 
Note: for a dictionary you can also use <code>DCSDictionaryAssetQuery</code>
  
 
See also [[ASAsset]].
 
See also [[ASAsset]].

Latest revision as of 12:59, 6 June 2016

ASAssetQuery is used to list a set of assets on your iDevice. Assets are generally stored in /var/mobile/Library/Assets/

Here is how we list all the dictionary assets on the iDevice

ASAssetQuery * aq = [[%c(ASAssetQuery) alloc] initWithAssetType:@"com.apple.MobileAsset.DictionaryServices.dictionary2"];
NSError *err = nil;
[aq runQueryAndReturnError:&err];
HBLogDebug(@"err = %@", err);
NSArray *results = [aq results];
HBLogDebug(@"results = %@", results)

Note: for a dictionary you can also use DCSDictionaryAssetQuery

See also ASAsset.