Realm.io: Save listing

Given the following:

typedef NS_OPTIONS(NSUInteger, AssetClass)
{
    AssetClassFixed = 1,
    AssetClassPortable = 2
};

How can I define an object to be saved with an enumeration type property?

@interface MyEntity : RLMObject

@property AssetClass assetClass;

@end
+4
source share
1 answer

Failure expected:

'Cannot save property "assetClass" with incompatible type. add to ignoredPropertyNames: ignore method.

With Objective-C enums, the only reason it doesn't work is because the enum type is based on an unsigned type, which is not yet supported .

If you change it to a signed type, it should work without the alias property.

-typedef NS_OPTIONS(NSUInteger, AssetClass)
+typedef NS_OPTIONS(NSInteger, AssetClass)
+5
source

All Articles