2014-11-19 3 views
0

에 이메일 링크를 통해 앱을 열어야한다는 요구 사항이 있습니다.이메일에서 iPhone 앱을 여는 방법은 무엇입니까?

이 들어

나는 이메일 버튼 액션에 다음 코드를 사용하고

- (IBAction)sendMail:(id)sender { 

    // From within your active view controller 
    if([MFMailComposeViewController canSendMail]) { 
     MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init]; 
     mailCont.mailComposeDelegate = self;// Required to invoke mailComposeController when send 

     [mailCont setSubject:@“Email]; 
     [mailCont setToRecipients:[NSArray arrayWithObject:@"Receipts"]]; 

     NSMutableString *mutableString=[[NSMutableString alloc] initWithString:@"Hi,<br>\n"]; 

     [mutableString appendString:[NSString stringWithFormat:@"<br> <a href=\"PracticeExample://\">Open my app</a></br>"]]; 





     NSString *emailBody =[NSString stringWithFormat:@"<html><body>%@</br></body></html>",mutableString]; 

     [mailCont setMessageBody:emailBody isHTML:YES]; 

     [self presentViewController:mailCont animated:YES completion:nil]; 
    } 
} 

나는 사파리를 열지 않고 앱을 열고 표시되지 내 이메일에서 링크를 "내 앱을 엽니 다"를 클릭하면 "사파리가 페이지를 열 수 없습니다 ... .."텍스트.

사파리 주소 상자에서 웹 사이트 이름이 "PracticeExample //"으로 변경되면 "PracticeExample : //"으로 변경되면 내 앱이 열립니다.

참고 : "PracticeExample"은 Plist의 맞춤 URL 스키마에 다음 링크를 사용하여 등록합니다. http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

** 응용 프로그램은 장치에 설치되어 있지 않은 경우 앱 스토어를 여는 방법을 하나 개 더 질문? **

답변

0

난 당신이 설정에 사용자 정의 균일 한 유형 식별자 (UTI)를해야합니다 생각합니다. 이 솔루션을 살펴보십시오. 나는 this이 당신이 찾고있는 대답이라고 믿습니다.

또한 사용자 정의 파일 유형의 핵심 인 NSKeyedArchiver의 경우 Apple documentation을 볼 필요가 있습니다. 이것을 사용하여 특정 디렉토리에서 파일을 읽고 쓸 수 있습니다.

관련 문제