我有一个带有safari扩展的应用程序。它使用文件作为源:
NSItemProvider *attachment = [[NSItemProvider alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"easylist_with_acceptable_ads" withExtension:@"json"]];
NSExtensionItem *item = [[NSExtensionItem alloc] init];
item.attachments = @[attachment];
[context completeRequestReturningItems:@[item] completionHandler:nil];但是现在我要从CoreData中获得它,我有NSString,它的JSON数据相当于easylist_with_acceptable_ads.json文件中的数据
除了url的内容之外,我如何在NSItemProvider中加入NSString呢?
发布于 2015-10-25 21:59:12
晚会晚了,但:
NSItemProvider *attachment = [[NSItemProvider alloc] initWithItem:yourJsonString typeIdentifier:@"public.json"];
https://stackoverflow.com/questions/32615958
复制相似问题