2012-05-05 20 views
6

Hi muszę zaimportować edytowany obraz w Instagram, coś PhotoStudio:Otwórz zdjęcie z Instagram

enter image description here

I podbił moje zdjęcie z tego kodu:

UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0); 
    [self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()]; 
    UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext(); 

    UIGraphicsEndImageContext(); 

następnie trzeba otwórz to screenShot z Instagram:


EDITED:

zaimplementować metodę tak:

UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0); 
    [self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()]; 
    UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 
    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]]; 

    docFile.UTI = @"com.instagram.photo"; 
    [self setupDocumentControllerWithURL:igImageHookFile]; 

    NSURL *instagramURL = [NSURL URLWithString:@"instagram://media?id=MEDIA_ID"]; 
    if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { 
     [[UIApplication sharedApplication] openURL:instagramURL]; 
    } 

    else { 
     NSLog(@"No Instagram Found"); 
    } 
} 

Ale odbierać tego wyjścia:

2012-05-05 21:55:36.842 InstantFrame[855:707] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-1914.84/UIDocumentInteractionController.m:1094 
2012-05-05 21:55:36.848 InstantFrame[855:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme (null). Only the file scheme is supported.' 

Instagram będzie otwarty, ale niczego nie importować.

+1

Zobacz na to pytanie: http://stackoverflow.com/questions/8302593/iphone-open-in-in-sdk – Jonathan

+0

zrobiliście z Instagram? plz podziel się ze mną instagram part – Hiren

+0

Spróbuj również tej odpowiedzi: http://stackoverflow.com/a/5631674/2284713 Używanie [NSURL plikURLWithPath: urPath] dla igImageHookFile pracował dla mnie. – weienw

Odpowiedz

1

Co chcesz zrobić, to otworzyć specjalnie sformatowany adres URL.

Oto dokumentacja instragram I z szybkiego wyszukiwania google znaleziono:

http://instagr.am/developer/iphone-hooks/

Oto docs jabłoni, która opisuje schemat proces URL. http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007891-SW1

+0

Czy mógłbyś zobaczyć moje zmodyfikowane pytanie? dziękuję –

+0

Problem polega na ustawianiu identyfikatora dokumentu. Ustawiasz ID na "zrzut ekranu". Ale zrzut ekranu to UIImage. Dowiedz się, jak uzyskać identyfikator obrazu, a następnie użyj tego. – scord

0

Aby udostępnić obraz na Instagram, minimalny rozmiar obrazu powinien wynosić 612x612. Poza tym nie importuje obrazu.