

iOSのShare Extensionを使って、外部アプリから単純に画像、タイトル、URLを獲得する機能を実装しようとしているのですがうまくいきません。

システムログを見ると、"The _SandboxProfile key is not available on this
platform."と言われており、Xcodeのコンソールでも"Failed to inherit CoreMedia
permissions"と表示されるので、何らかのキーがうまく設定できないのだなと理解しています。

App Groupsの設定は、Developer
Siteで登録し、それをXcodeの"capabilities"で本体アプリとextensionにも設定した上で、本体アプリのAppDelegate.mにて

[code]

    [[NSUserDefaults alloc] initWithSuiteName:@"App Groups名"];
    
[/code]

と記述しています。

どう対処したらよいのか分からず、詰まってしまっており、アドバイス頂けたらうれしいです。

Simulatorで実行した際のシステムログ (debug > open system log)

[code]

    Unknown activity items supplied: (
            "http://www.bing.com/",
            "<WBUPrintPageRenderer: 0x7f9f33583d00>",
            "<UIPrintInfo: 0x7f9f33597c30>"
        )
    assigning plug-in nu.yuichi.TreasureBox.Share(1.0) to plugin sandbox
    enabling pid=37826 for plug-in nu.yuichi.TreasureBox.Share(1.0) B67C5E4D-676F-4F66-A0AA-D110C14ABF0C /Users/yuichimaxkato/Library/Developer/CoreSimulator/Devices/B1F9CE83-D5FE-4287-90CC-08A5DAD57BDA/data/Containers/Bundle/Application/FE12100E-C40D-4749-A481-3058E4CA83CB/TreasureBox.app/PlugIns/Share.appex
    The _SandboxProfile key is not available on this platform.
     The _OmitSandboxParameters key is not available on this platform.
     invoked for service: nu.yuichi.TreasureBox.Share pid: 0
     invoked for service: nu.yuichi.TreasureBox.Share pid: 37835
    (com.apple.imfoundation.IMRemoteURLConnectionAgent): The _DirtyJetsamMemoryLimit key is not available on this platform.
    Ignoring lax activation attempt for unsupported domain: nu.yuichi.TreasureBox.Share
    Ignoring lax activation attempt for unsupported domain: nu.yuichi.TreasureBox.Share.viewservice
    Ignoring lax activation attempt for unsupported domain: nu.yuichi.TreasureBox.Share.apple-extension-service
    assertion failed: 14B25 12B411: assertiond + 11523 [3F572A0B-7E12-378D-AFEE-EA491BAF2C36]: 0x1
    --- last message repeated 1 time ---
    Failed to inherit CoreMedia permissions from 37826: (null)
    SLComposeServiceViewController got NSURL http://www.bing.com/ for public.url error: (null)
    SLComposeServiceViewController got attachment coarseType 3
    Unable to bootstrap_look_up port with name nu.yuichi.TreasureBox.Share.gsEvents: unknown error code (1102)
     assertion failed: 14B25 12B411: assertiond + 11523 [3F572A0B-7E12-378D-AFEE-EA491BAF2C36]: 0x1
     --- last message repeated 7 times ---
     [SFActivityAdvertiser] ERROR: no XPC proxy, queuing advertisement <51ce8795 f1ba0601 80>
    assertion failed: 14B25 12B411: assertiond + 11523 [3F572A0B-7E12-378D-AFEE-EA491BAF2C36]: 0x1
    [SFActivityAdvertiser] ERROR: no XPC proxy, queuing advertisement <51ce8795 f1ba0601 00>
    シェアするURL(null)
    シェアするタイトル(null)
    
[/code]

ShareViewController.m

[code]

    #import "ShareViewController.h"
    #import <MobileCoreServices/MobileCoreServices.h>
    
    @interface ShareViewController ()
    
    @property NSString *urlString;
    @property NSString *titleString;
    @property UIImage *thumImage;
    
    @end
    
    @implementation ShareViewController
    
    - (BOOL)isContentValid {
        // Do validation of contentText and/or NSExtensionContext attachments here
        return YES;
    }
    
    - (void)didSelectPost {
        // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
    
        NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
        NSItemProvider *itemProvider = item.attachments.firstObject;
    
        if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeURL])
        {
            [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSURL *url, NSError *error) {
                self.urlString = url.absoluteString;
            }];
        }
    
        if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeText])
        {
            [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeText options:nil completionHandler:^(NSString *text, NSError *error)  {
                self.titleString = text;
            }];
        }
    
        //NSExtensionItem *imageItem = [self.extensionContext.inputItems firstObject];
    
        if([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeImage]){
    
            // 入力画像を取得
            [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(UIImage *image, NSError *error) {
    
                if(image){
                    dispatch_async(dispatch_get_main_queue(), ^{
    
                        self.thumImage = image;
                        // 画像を反転させる
                        //UIImage* invertedImage = [self invertedImage:image];
    
                        // 表示
                        //[imageView setImage:invertedImage];
                    });
    
                }
            }];
    
        }
    
         NSLog(@"シェアするURL%@", _urlString);
         NSLog(@"シェアするタイトル%@", _titleString);
    
    }
    
    - (NSArray *)configurationItems {
        // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
        return @[];
    }
    
    @end
    
[/code]


CC BY-SA 3.0
2014-12-20T10:21:21.790
2236
2014-12-20T10:35:49.107
2014-12-20T10:35:49.107
682
682
question
ios objective-c
iOSのShare extensionがうまく動作しない（Profile Keyの問題？）