标签: uidocumentinteraction

Instagram直接打开UTI

我最近偶然发现了以下有趣的功能:Instagram iPhone Hooks

我想知道是否能够立即通过documentinteractioncontroller打开应用程序,无需显示预览( - presentPreviewAnimated :)或操作表( - presentOpenInMenuFromRect:inView:animated :).在我看来,这是唯一的方式,但我可能会遗漏一些东西.

-(void) saveToInstagram {
    NSURL *url;
    UIDocumentInteractionController *dic;
    CGRect rect = CGRectMake(0 ,0 , 0, 0);
    UIImage *i = imageView.image;
    CGRect cropRect = CGRectMake(i.size.width - 306 ,i.size.height - 306 , 612, 612);
    NSString  *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.ig"];
    CGImageRef imageRef = CGImageCreateWithImageInRect([imageView.image CGImage], cropRect);
    UIImage *img = [[UIImage alloc] initWithCGImage:imageRef];
    CGImageRelease(imageRef);

    [UIImageJPEGRepresentation(img, 1.0) writeToFile:jpgPath atomically:YES];
    url = [[NSURL alloc] initFileURLWithPath:jpgPath];
    dic = [self setupControllerWithURL:url usingDelegate:self];
    [dic presentOpenInMenuFromRect:rect inView:self.view animated:YES]; …
Run Code Online (Sandbox Code Playgroud)

objective-c ios4 ios uidocumentinteraction instagram

14
推荐指数
2
解决办法
8713
查看次数

UIDocumentInteractionController中的自定义"电子邮件"操作

有没有办法将自定义操作添加到UIDocumentInteractionController提供的操作列表中?

我想在列表中添加"电子邮件"操作.我知道我可以使用MFMailComposeViewController发送带附件的电子邮件,但问题不在于如何将文件作为附件发送,问题是UI之一.我有一个"行动"的UIBarButtonItem带来了UIDocumentInteractionController提供在iBooks的印刷和开放的选项.太棒了...但我还需要一个单独的UIBarButtonItem来发送附加到电子邮件的文件.用户看到这样的东西有点令人困惑:

电子邮件和操作按钮的屏幕截图

这不仅仅是让用户感到困惑,更不是理想的用户界面.最好将"Email"作为UIDocumentInteractionController列表中的一个选项.

有什么建议?

肯尼

email iphone ipad ios uidocumentinteraction

13
推荐指数
1
解决办法
4036
查看次数

在iOS中使用mime类型或UTI类型的内置图标

问题:

我希望能够在我的二进制文件内容列表中使用标准mime类型(或UTI类型)的内置iOS图标.

背景:

我已经研究过使用新的(自3.2)文档体系结构,但是使用UIDocumentInteractionController似乎假设实际的二进制文件已经在本地设备上了.

在我的情况下,我有一个远程服务器的文件列表,并知道远程文件的mime类型,名称,标题等,所以我只想显示带有图标的文件列表(实际二进制文件仅根据需要加载).

我从服务器获取的元数据包含二进制文件的正确mime类型,所以理论上我只想根据类型获取系统图标.

解决?

我尝试了以下"黑客"作为概念的证明,它似乎工作,但这似乎不是最好的方式...

//Need to initialize this way or the doc controller doesn't work
NSURL*fooUrl = [NSURL URLWithString:@"file://foot.dat"];
UIDocumentInteractionController* docController = [[UIDocumentInteractionController interactionControllerWithURL:fooUrl] retain];

UIImage* thumbnail = nil;
//Need to convert from mime type to a UTI to be able to get icons for the document
NSString *uti = [NSMakeCollectable(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (CFStringRef)self.contentType, NULL)) autorelease];

//Tell the doc controller what UTI type we want
docController.UTI = uti;

//The doc controller now seems to have icon(s) for the …
Run Code Online (Sandbox Code Playgroud)

iphone ios uidocumentinteraction

13
推荐指数
3
解决办法
4855
查看次数

警告:对QLRemotePreviewContentController的开始/结束外观转换的不平衡调用

我已经为这个问题找到了一些解决方案(这是因为仍然有一个活动的动画引起的).

但是在iPad应用程序上使用UIDocumentInteractionController时,我无法在我的应用程序中解决这个问题.

我的ViewController看起来像

MainViewController - > ContainerView

在这个ContainerView我有一个侧边栏,从这个SideBar我想打开一个UIDocumentInteractionController.

我使用NSNotification,因为这个"MainViewController"应该处理来自不同视图的多个文件.

所以:(这是在我的MainViewController中)

func openFile(notification: NSNotification){

    fileUrl = notification.object as NSURL

    var documentInteractionController = UIDocumentInteractionController(URL: self.fileUrl!)
    documentInteractionController.delegate = self

    documentInteractionController.presentPreviewAnimated(false)
}

func documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController) -> UIViewController {
    return self
}
Run Code Online (Sandbox Code Playgroud)

但生病总是得到以下错误:

警告:对QLRemotePreviewContentController的开始/结束外观转换的不平衡调用

我不知道为什么?应该没有动画,如果我打开另一个(模态)窗口,这里没有警告.

如果我使用延迟(例如5秒!),则会出现此警告.

编辑:发现我可能是我的ContainerView的问题.当我包含"ViewWillDissapear"和"ViewDidDisappear"时,我在这里得到错误:

view will dissappear

Unbalanced calls to begin/end appearance transitions for <QLRemotePreviewContentController: 0x7d35d400>

viww Did dissapaer
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?提前致谢

quicklook ipad ios uidocumentinteraction swift

13
推荐指数
1
解决办法
6585
查看次数

UIActivityViewController与ios中的UIDocumentInteractionController

我刚才读了一些文章UIActivityViewControllerUIDocumentInteractionControlleriOS中,但我如何,因为双方似乎都一样用起来很困惑.

那么,我什么时候使用 UIActivityViewControllerUIDocumentInteractionController

Open In...和使用有什么区别UIActivityViewController吗?

我对如何使用它们感到非常困惑.请告诉我他们的具体用途.

iphone sharing ios uidocumentinteraction uiactivityviewcontroller

12
推荐指数
2
解决办法
7937
查看次数

与Whatsapp和Facebook分享图片

我已经能够与Whatsapp分享照片,但我这样做的方法是在a中提供Whatsapp选项UIActivityViewController,然后显示一个UIDocumentInteractionController.

从这里UIDocumentInteractionController,我选择Whatsapp选项,将用户重定向到Whatsapp并让他分享照片.

到目前为止我的代码是这样的:

if ([activityType isEqualToString:@"whatsappSharing"]) {
    if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]) {
        NSString *savePath  = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];

        [UIImageJPEGRepresentation(finalImage, 1.0) writeToFile:savePath atomically:YES];

        weakDocumentInteraction = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
        weakDocumentInteraction.UTI = @"net.whatsapp.image";
        weakDocumentInteraction.delegate = weakSelf;

        [weakDocumentInteraction presentOpenInMenuFromRect:CGRectZero inView:weakSelf.view animated:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望能够从a中选择UIActivityViewController并直接显示Whatsapp.

有没有办法跳过第二部分呈现UIDocumentInteractionController并以编程方式选择Whatsapp应用程序选项?

目前,用户必须选择两次Whatsapp选项才能共享图像.

PS:我正在使用,UIActivityViewController因为我也在使用其他活动.

objective-c ios uidocumentinteraction whatsapp uiactivityviewcontroller

12
推荐指数
1
解决办法
2万
查看次数

如何将其他内容保存到我的UIManagedDocument文件包中?

我在解读Apple的文档UIManagedDocument方面遇到了很多麻烦,特别是以下方法:

  • - (id)additionalContentForURL:(NSURL *)absoluteURL error:(NSError **)error
  • - (BOOL)readAdditionalContentFromURL:(NSURL *)absoluteURL error:(NSError **)error
  • - (BOOL)writeAdditionalContent:(id)content toURL:(NSURL *)absoluteURL originalContentsURL:(NSURL *)absoluteOriginalContentsURL error:(NSError **)error

有没有人成功地将其他内容保存到UIManagedDocument包中的"添加内容"目录中?我希望使用UUID作为文件名(具有正确的文件扩展名)将直接图像(PNG,JPEG等)和视频(m4v等)保存到此目录中,并将对这些单个文件的引用存储为NSString我的文件路径持久存储.

cocoa-touch core-data ios uidocumentinteraction

11
推荐指数
1
解决办法
2532
查看次数

UIDocumentInteractionController不再适用于iOS6

我有一个应用程序,它与为iOS5构建的Instagram共享,现在在iOS6中共享,虽然canOpenURL返回true并且代码执行,但共享不再有效.图像将以.igo扩展名保存到应用程序的文档文件夹中.这是通过com.instagram.exclusivegram传递给Instagram的.

代码如下,它进入if语句并显示"here in"但不会像屏幕底部那样打开Share With对话框.

        NSLog(@"%@", _imgToUpload);
        NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
        if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
            uidController = [[UIDocumentInteractionController alloc] init];
            //imageToUpload is a file path with .igo file extension
            uidController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:_imgToUpload]];
            uidController.UTI = @"com.instagram.exclusivegram";
            uidController.delegate = self;
            CGRect navRect = self.view.frame;
            [uidController presentOpenInMenuFromRect:navRect inView:[UIApplication sharedApplication].keyWindow animated:YES];
            NSLog(@"here in");
        }
Run Code Online (Sandbox Code Playgroud)

_imgToUpload 也提供了正确的文件路径.

谢谢,尼克

iphone xcode objective-c uidocumentinteraction ios6

11
推荐指数
1
解决办法
5138
查看次数

如何在本机IOS日历中添加事件

我想从我的应用程序中打开本机IOS日历(ical)并添加事件.有什么方法可以打开特定活动的日历吗?

我还以编程方式关注Open iphone日历应用程序,但尚未成功.

icalendar ios uidocumentinteraction

10
推荐指数
2
解决办法
2万
查看次数

UIDocumentInteractionController需要很长时间才能显示选项

我已经使用UIDocumentInteractionController来共享文件,但它在iOS 8 beta 5中25秒后打开菜单选项,并且在iOS 7.1中运行良好.

我已经验证了我粘贴在下面的日志

Errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo=0x79bd5ef0 {NSLocalizedDescription=query cancelled}
2014-08-27 15:02:05.634 Localwire[82067:1364165] Unknown activity items supplied: (
        {
        "com.microsoft.excel.xls" = <d0cf11e0 a1b11ae1 00000000 00000000 00000000 00000000 3e000300 feff0900 06000000 00000000 00000000 10000000 01000000 00000000 00100000 cb070000 01000000 feffffff 00000000 00000000 62000000 e3000000 64010000 e5010000 66020000 e7020000 68030000 e9030000 6a040000 eb040000 6c050000 ed050000 6e060000 ef060000 70070000 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
Run Code Online (Sandbox Code Playgroud)

我不知道问题是什么.

iphone objective-c ios uidocumentinteraction ios8

10
推荐指数
1
解决办法
3889
查看次数