iOS Developer

iOS11 中 Foundation.framework 的主要

2017-09-13  本文已影响345人  wwwbbat

标记了许多方法、属性、枚举、常量在watchos,tvos上可用,下面不再一一列出

FoundationErrors.h

- 枚举类型 NSCocoaErrorDomain 新增值:NSCoderInvalidValueError

FoundationLegacySwiftCompatibility.h

- 增加 NSBundle 等一些类的接口

NSArray.h

- 新增方法: - (BOOL)writeToURL:(NSURL *)url error:(NSError **)error;
- 新增方法: - (nullable NSArray<ObjectType> *)initWithContentsOfURL:(NSURL *)url error:(NSError **)error;
- 新增方法: + (nullable NSArray<ObjectType> *)arrayWithContentsOfURL:(NSURL *)url error:(NSError **)error;
- 废弃方法:
        - (void)getObjects:(ObjectType _Nonnull __unsafe_unretained [_Nonnull])objects;
        + (nullable NSArray<ObjectType> *)arrayWithContentsOfFile:(NSString *)path;
        + (nullable NSArray<ObjectType> *)arrayWithContentsOfURL:(NSURL *)url;
        - (nullable NSArray<ObjectType> *)initWithContentsOfFile:(NSString *)path;
        - (nullable NSArray<ObjectType> *)initWithContentsOfURL:(NSURL *)url;
        - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile;
        - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically;

NSAttributedString.h

- 增加别名 NSAttributedStringKey 属性名类型使用NSString的地方都改用此别名

NSCoder.h

- 新增方法:- (void)decodeValueOfObjCType:(const char *)type at:(void *)data size:(NSUInteger)size
- 废弃方法:- (void)decodeValueOfObjCType:(const char *)type at:(void *)data;

NSDateComponentsFormatter.h

- 新增属性:@property (nullable, copy) NSDate *referenceDate; 

NSDictionary.h

- 新增方法:- (BOOL)writeToURL:(NSURL *)url error:(NSError **)error;
- 新增方法:- (nullable NSDictionary<NSString *, ObjectType> *)initWithContentsOfURL:(NSURL *)url error:(NSError **)error;
- 新增方法:+ (nullable NSDictionary<NSString *, ObjectType> *)dictionaryWithContentsOfURL:(NSURL *)url error:(NSError **)error;
- 废弃方法:
        + (nullable NSDictionary<KeyType, ObjectType> *)dictionaryWithContentsOfFile:(NSString *)path;
        + (nullable NSDictionary<KeyType, ObjectType> *)dictionaryWithContentsOfURL:(NSURL *)url;
        - (nullable NSDictionary<KeyType, ObjectType> *)initWithContentsOfFile:(NSString *)path;
        - (nullable NSDictionary<KeyType, ObjectType> *)initWithContentsOfURL:(NSURL *)url;
        - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile;
        - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically;

NSError.h

- 公开常量:NSDebugDescriptionErrorKey
- 新增常量:NSLocalizedFailureErrorKey

NSFileCoordinator.h

- 新增方法:- (void)itemAtURL:(NSURL *)url didChangeUbiquityAttributes:(NSSet <NSURLResourceKey> *)attributes;

NSFileManager.h

- 增加别名:NSFileProviderServiceName
- 新增方法:- (void)getFileProviderServicesForItemAtURL:(NSURL *)url completionHandler:(void (^)(NSDictionary <NSFileProviderServiceName, NSFileProviderService *> * _Nullable services, NSError * _Nullable error))completionHandler;
- 新增类:NSFileProviderService

NSFilePresenter.h

- 新增方法:- (void)presentedItemDidChangeUbiquityAttributes:(NSSet<NSURLResourceKey> *)attributes;
- 新增属性:@property (readonly, strong) NSSet<NSURLResourceKey> *observedPresentedItemUbiquityAttributes;

NSFileVersion.h

- 公开属性:@property (nullable, readonly, copy) NSPersonNameComponents *originatorNameComponents

NSISO8601DateFormatter.h

- 枚举NSISO8601DateFormatOptions新增值:NSISO8601DateFormatWithFractionalSeconds

NSItemProvider.h

- 新增枚举类型:NSItemProviderRepresentationVisibility
- 新增枚举类型:NSItemProviderFileOptions
- 新增协议:NSItemProviderWriting
- 新增协议:NSItemProviderReading
- 新增方法:- (void)registerDataRepresentationForTypeIdentifier:(NSString *)typeIdentifier
                                     visibility:(NSItemProviderRepresentationVisibility)visibility
                                    loadHandler:(NSProgress * _Nullable (^)(void (^completionHandler)(NSData * _Nullable data, NSError * _Nullable error)))loadHandler;
- 新增方法:- (void)registerFileRepresentationForTypeIdentifier:(NSString *)typeIdentifier
                                    fileOptions:(NSItemProviderFileOptions)fileOptions
                                     visibility:(NSItemProviderRepresentationVisibility)visibility
                                    loadHandler:(NSProgress * _Nullable (^)(void (^completionHandler)(NSURL * _Nullable url, BOOL coordinated, NSError * _Nullable error)))loadHandler
- 新增方法:- (NSArray<NSString *> *)registeredTypeIdentifiersWithFileOptions:(NSItemProviderFileOptions)fileOptions;
- 新增方法:- (BOOL)hasRepresentationConformingToTypeIdentifier:(NSString *)typeIdentifier;
                                    fileOptions:(NSItemProviderFileOptions)fileOptions;
- 新增方法:- (NSProgress *)loadDataRepresentationForTypeIdentifier:(NSString *)typeIdentifier
                                  completionHandler:(void(^)(NSData * _Nullable data, NSError * _Nullable error))completionHandler ;
- 新增方法:- (NSProgress *)loadFileRepresentationForTypeIdentifier:(NSString *)typeIdentifier
                                  completionHandler:(void(^)(NSURL * _Nullable url, NSError * _Nullable error))completionHandler;
- 新增方法:- (NSProgress *)loadInPlaceFileRepresentationForTypeIdentifier:(NSString *)typeIdentifier
                                         completionHandler:(void (^)(NSURL * _Nullable url, BOOL isInPlace, NSError * _Nullable error))completionHandler;
- 新增属性:@property (atomic, copy, nullable) NSString *suggestedName;
- 新增方法:- (instancetype)initWithObject:(id<NSItemProviderWriting>)object;
- 新增方法:- (void)registerObject:(id<NSItemProviderWriting>)object visibility:(NSItemProviderRepresentationVisibility)visibility;
- 新增方法:- (void)registerObjectOfClass:(Class<NSItemProviderWriting>)aClass
               visibility:(NSItemProviderRepresentationVisibility)visibility
              loadHandler:(NSProgress * _Nullable (^)(void (^completionHandler)(id<NSItemProviderWriting> _Nullable object, NSError * _Nullable error)))loadHandler;
- 新增方法:- (BOOL)canLoadObjectOfClass:(Class<NSItemProviderReading>)aClass;
- 新增方法:- (NSProgress *)loadObjectOfClass:(Class<NSItemProviderReading>)aClass
            completionHandler:(void (^)(id<NSItemProviderReading> _Nullable object, NSError * _Nullable error))completionHandler;

NSJSONSerialization.h

- 枚举 NSJSONWritingOptions 新增值:NSJSONWritingSortedKeys

NSLinguisticTagger.h

- 新增别名:NSLinguisticTagScheme
- 新增别名:NSLinguisticTag
- 新增枚举类型:NSLinguisticTaggerUnit
- 新增方法:+ (NSArray<NSLinguisticTagScheme> *)availableTagSchemesForUnit:(NSLinguisticTaggerUnit)unit language:(NSString *)language;
- 新增方法:- (NSRange)tokenRangeAtIndex:(NSUInteger)charIndex unit:(NSLinguisticTaggerUnit)unit;
- 新增方法:- (void)enumerateTagsInRange:(NSRange)range unit:(NSLinguisticTaggerUnit)unit scheme:(NSLinguisticTagScheme)scheme options:(NSLinguisticTaggerOptions)options usingBlock:(void (NS_NOESCAPE ^)(NSLinguisticTag _Nullable tag, NSRange tokenRange, BOOL *stop))block;
- 新增方法:- (nullable NSLinguisticTag)tagAtIndex:(NSUInteger)charIndex unit:(NSLinguisticTaggerUnit)unit scheme:(NSLinguisticTagScheme)scheme tokenRange:(nullable NSRangePointer)tokenRange;
- 新增方法:- (NSArray<NSLinguisticTag> *)tagsInRange:(NSRange)range unit:(NSLinguisticTaggerUnit)unit scheme:(NSLinguisticTagScheme)scheme options:(NSLinguisticTaggerOptions)options tokenRanges:(NSArray<NSValue *> * _Nullable * _Nullable)tokenRanges;
- 新增属性:@property (nullable, readonly, copy) NSString *dominantLanguage;
- 新增方法:+ (nullable NSString *)dominantLanguageForString:(NSString *)string;
- 新增方法:+ (nullable NSLinguisticTag)tagForString:(NSString *)string atIndex:(NSUInteger)charIndex unit:(NSLinguisticTaggerUnit)unit scheme:(NSLinguisticTagScheme)scheme orthography:(nullable NSOrthography *)orthography tokenRange:(nullable NSRangePointer)tokenRange;
- 新增方法:+ (NSArray<NSLinguisticTag> *)tagsForString:(NSString *)string range:(NSRange)range unit:(NSLinguisticTaggerUnit)unit scheme:(NSLinguisticTagScheme)scheme options:(NSLinguisticTaggerOptions)options orthography:(nullable NSOrthography *)orthography tokenRanges:(NSArray<NSValue *> * _Nullable * _Nullable)tokenRanges;
- 新增方法:+ (void)enumerateTagsForString:(NSString *)string range:(NSRange)range unit:(NSLinguisticTaggerUnit)unit scheme:(NSLinguisticTagScheme)scheme options:(NSLinguisticTaggerOptions)options orthography:(nullable NSOrthography *)orthography usingBlock:(void (NS_NOESCAPE ^)(NSLinguisticTag _Nullable tag, NSRange tokenRange, BOOL *stop))block;

NSMetadataAttributes.h

- 公开常量:NSMetadataUbiquitousItemIsSharedKey
- 公开常量:NSMetadataUbiquitousSharedItemCurrentUserRoleKey
- 公开常量:NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey
- 公开常量:NSMetadataUbiquitousSharedItemOwnerNameComponentsKey
- 公开常量:NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey
- 公开常量:NSMetadataUbiquitousSharedItemRoleOwner
- 公开常量:NSMetadataUbiquitousSharedItemRoleParticipant
- 公开常量:NSMetadataUbiquitousSharedItemPermissionsReadOnly
- 公开常量:NSMetadataUbiquitousSharedItemPermissionsReadWrite

NSOrthography.h

- 新增方法:+ (instancetype)defaultOrthographyForLanguage:(NSString *)language;

NSPathUtilities.h

- 枚举类型NSSearchPathDirectory的值NSTrashDirectory在iOS11上可用

NSPort.h

- 废弃方法:- (void)addConnection:(NSConnection *)conn toRunLoop:(NSRunLoop *)runLoop forMode:(NSRunLoopMode)mode NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead”);
- 废弃方法:- (void)removeConnection:(NSConnection *)conn fromRunLoop:(NSRunLoop *)runLoop forMode:(NSRunLoopMode)mode

NSProcessInfo.h

- 枚举类型NSProcessInfoThermalState在iOS11上可用
- 属性:thermalState 在iOS11上可用
- 通知:NSProcessInfoThermalStateDidChangeNotification 在iOS11上可用

NSProgress.h

- 新增方法:- (void)performAsCurrentWithPendingUnitCount:(int64_t)unitCount usingBlock:(void (NS_NOESCAPE ^)(void))work;
- 公开属性:@property (readonly, getter=isFinished) BOOL finished;
- 新增属性:@property (nullable, copy) NSNumber *estimatedTimeRemaining;
- 新增属性:@property (nullable, copy) NSNumber *throughput;
- 新增属性:@property (nullable, copy) NSProgressFileOperationKind fileOperationKind;
- 新增属性:@property (nullable, copy) NSURL *fileURL;
- 新增属性:@property (nullable, copy) NSNumber *fileTotalCount;
- 新增属性:@property (nullable, copy) NSNumber *fileCompletedCount;

NSTextCheckingResult.h

- 新增方法:- (NSRange)rangeWithName:(NSString *)name;

NSUnit.h

- 标记方法不可用:- (instancetype)init NS_UNAVAILABLE;
- 标记方法不可用:+ (instancetype)new NS_UNAVAILABLE;

NSURL.h

- 新增常量:NSURLVolumeSupportsImmutableFilesKey
- 新增常量:NSURLVolumeSupportsAccessPermissionsKey
- 新增常量:NSURLVolumeAvailableCapacityForImportantUsageKey
- 新增常量:NSURLVolumeAvailableCapacityForOpportunisticUsageKey
- 公开iOS10常量:NSURLUbiquitousItemIsSharedKey
- 公开iOS10常量:NSURLUbiquitousSharedItemCurrentUserRoleKey
- 公开iOS10常量:NSURLUbiquitousSharedItemCurrentUserPermissionsKey
- 公开iOS10常量:NSURLUbiquitousSharedItemOwnerNameComponentsKey
- 公开iOS10常量:NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey
- 公开iOS10常量:NSURLUbiquitousSharedItemRoleOwner
- 公开iOS10常量:NSURLUbiquitousSharedItemRoleParticipant
- 公开iOS10常量:NSURLUbiquitousSharedItemPermissionsReadOnly
- 公开iOS10常量:NSURLUbiquitousSharedItemPermissionsReadWrite
- NSURL实现协议:NSItemProviderReading、NSItemProviderWriting
- NSURLComponents 新增属性:@property (nullable, copy) NSArray<NSURLQueryItem *> *percentEncodedQueryItems;

NSURLSession.h

- 类 NSURLSessionTask 实现协议:NSProgressReporting
- 类 NSURLSessionTask 新增属性:@property (readonly, strong) NSProgress *progress;
- 类 NSURLSessionTask 新增属性:@property (nullable, copy) NSDate *earliestBeginDate;
- 类 NSURLSessionTask 新增属性:@property int64_t countOfBytesClientExpectsToSend;
- 类 NSURLSessionTask 新增属性:@property int64_t countOfBytesClientExpectsToReceive;
- 新增枚举类型:NSURLSessionMultipathServiceType
- 类 NSURLSessionConfiguration 新增属性:@property BOOL waitsForConnectivity;
- 类 NSURLSessionConfiguration 新增属性:@property NSURLSessionMultipathServiceType multipathServiceType;
- 新增枚举类型:NSURLSessionDelayedRequestDisposition
- 协议 NSURLSessionTaskDelegate 新增方法:- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
                    willBeginDelayedRequest:(NSURLRequest *)request
                          completionHandler:(void (^)(NSURLSessionDelayedRequestDisposition disposition, NSURLRequest * _Nullable newRequest))completionHandler;
- 协议 NSURLSessionTaskDelegate 新增方法:- (void)URLSession:(NSURLSession *)session taskIsWaitingForConnectivity:(NSURLSessionTask *)task;

NSUserActivity.h

- 新增属性:@property (nullable, copy) NSURL *referrerURL;

NSValue.h

- 新增方法:- (void)getValue:(void *)value size:(NSUInteger)size;
- 废弃方法:- (void)getValue:(void *)value;

NSXPCConnection.h

- 公开类 NSXPCConnection、NSXPCListener、NSXPCInterface、NSXPCListenerEndpoint
上一篇下一篇

猜你喜欢

热点阅读