NSDataAsset Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Platform-specific data object stored in an asset catalog.
[Foundation.Register("NSDataAsset", true)]
public class NSDataAsset : Foundation.NSObject, Foundation.INSCopying, IDisposable
[<Foundation.Register("NSDataAsset", true)>]
type NSDataAsset = class
inherit NSObject
interface INSCopying
interface INativeObject
interface IDisposable
- Inheritance
- Attributes
- Implements
Remarks
Asset catalogs are often used for icons and images, but may be used to deliver any kind of data in a platform-specific manner.
Within an asset catalog, there is one folder per data object. That folder contains platform-specific data files and a Contents.json file that maps platform characteristics to specific datafiles. For example:

Where Contents.json contains:
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"data" : [
{
"idiom" : "iphone",
"filename" : "iphone.wav",
"universal-type-identifier" : "com.microsoft.waveform-audio"
},
{
"idiom" : "ipad",
"filename" : "ipad.wav",
"universal-type-identifier" : "com.microsoft.waveform-audio"
}
]
}
To load an asset, call NSDataAsset(String) or NSDataAsset(String, NSBundle) passing the name of the folder. For instance:
var assetCatalog = new NSDataAsset ("FolderName");
var data = assetCatalog.Data;
var uti = assetCatalog.TypeIdentifier;
NSError error = null;
var player = new AVAudioPlayer (data, uti, out error);
if (player != null) { //...etc
The appropriate datafile for the hardware device will be loaded.
Constructors
| Name | Description |
|---|---|
| NSDataAsset(NativeHandle) |
A constructor used when creating managed representations of unmanaged objects. Called by the runtime. |
| NSDataAsset(NSObjectFlag) |
Constructor to call on derived classes to skip initialization and merely allocate the object. |
| NSDataAsset(String, NSBundle) |
Returns the data specified in the |
| NSDataAsset(String) |
Returns the data specified in the |
Properties
| Name | Description |
|---|---|
| AccessibilityAttributedUserInputLabels | (Inherited from NSObject) |
| AccessibilityRespondsToUserInteraction | (Inherited from NSObject) |
| AccessibilityTextualContext | (Inherited from NSObject) |
| AccessibilityUserInputLabels | (Inherited from NSObject) |
| Class | (Inherited from NSObject) |
| ClassHandle |
The Objective-C class handle for this class. |
| Data | |
| DebugDescription | (Inherited from NSObject) |
| Description | (Inherited from NSObject) |
| Handle |
Handle (pointer) to the unmanaged object representation. (Inherited from NSObject) |
| IsDirectBinding | (Inherited from NSObject) |
| IsProxy | (Inherited from NSObject) |
| Name | |
| RetainCount | (Inherited from NSObject) |
| Self | (Inherited from NSObject) |
| Superclass | (Inherited from NSObject) |
| SuperHandle |
Handle used to represent the methods in the base class for this NSObject. (Inherited from NSObject) |
| TypeIdentifier |
The UTI of the Data. |
| Zone | (Inherited from NSObject) |