'kUTTypeData' is deprecated: first deprecated in iOS 15.0

Code snippet: NSData* itemData = itemDict[(NSString*)kUTTypeData];

As per recommendation when I use UTTypeData instead of kUTTypeData, I am getting error. If someone facing the same issue and got any resolution, please let me know.

Have you seen this other (similar) question: https://developer.apple.com/forums/thread/684101

The same here for :

        kUTTypeFileURL 

        kUTTypeUTF8PlainText

despite import :

import MobileCoreServices
import UniformTypeIdentifiers

the error :

'kUTTypeFileURL' was deprecated in iOS 15.0: Use UTTypeFileURL instead.

'kUTTypeUTF8PlainText' was deprecated in iOS 15.0: Use UTTypeUTF8PlainText instead.

Seem to be :

UTType.fileURL.identifier
UTType.utf8PlainText.identifier

compiler happy :)

Thanks everyone for the response. Hi @uocram do you have anything for 'kUTTypeData', through which I can resolve this issue. Please let me know I will be happy to try.

Hi @OOPer I have tried the following but still having the issue. I have attached some code snippet for reference.

The import part:

The implementation part:

A simplified example of using UTTypeData in Objective-C:

#import "MyClass.h"
@import UniformTypeIdentifiers;

@implementation MyClass
- (void)testWithDictionary:(NSDictionary *)itemDict {
    NSData *itemData = itemDict[UTTypeData.identifier];
}
@end

UTTypeData is a constant declared in the module UniformTypeIdentifiers. You should not declare another UTTypeData in your code.

import UniformTypeIdentifiers

    static var draggableType = UTType.data.identifier

Apple doc :

Type Property

data A base type that represents any sort of byte stream, including files and in-memory data.

Discussion

The identifier for this type is public.data. This type conforms to UTTypeItem.

'kUTTypeData' is deprecated: first deprecated in iOS 15.0
 
 
Q