AI-generated Key Takeaways
-
MLKModelDownloadConditionsconfigures conditions for downloading machine learning models. -
It controls whether downloads can occur over cellular networks and in the background.
-
Developers can customize these conditions using
initWithAllowsCellularAccess:allowsBackgroundDownloading:or rely on the defaults withinit. -
By default, cellular access is allowed (
allowsCellularAccess = YES), but background downloading is not (allowsBackgroundDownloading = NO).
MLKModelDownloadConditions
@interface MLKModelDownloadConditions : NSObject <NSCopying>Configurations for model downloading conditions.
-
Indicates whether download requests should be made over a cellular network. The default is
YES.Declaration
Objective-C
@property (nonatomic, readonly) BOOL allowsCellularAccess; -
Indicates whether the model can be downloaded while the app is in the background. The default is
NO.Declaration
Objective-C
@property (nonatomic, readonly) BOOL allowsBackgroundDownloading; -
Creates a new instance with the given conditions.
Declaration
Objective-C
- (nonnull instancetype)initWithAllowsCellularAccess:(BOOL)allowsCellularAccess allowsBackgroundDownloading: (BOOL)allowsBackgroundDownloading;Parameters
allowsCellularAccessWhether download requests should be made over a cellular network.
allowsBackgroundDownloadingWhether the model can be downloaded while the app is in the background.
Return Value
A new
ModelDownloadConditionsinstance. -
Creates a new instance with the default conditions. The default values are specified in the documentation for each instance property.
Declaration
Objective-C
- (nonnull instancetype)init;Return Value
A new
ModelDownloadConditionsinstance.