2016-09-07 2 views
1

내가 좋아하는 뭔가를 시도했습니다 다음의 Info.plistiOS 9의 이메일 URL에서 앱을 여는 방법은 무엇입니까?

<key>CFBundleURLTypes</key> 
<array> 
    <dict> 
     <key>CFBundleURLName</key> 
     <string>co.example.ExampleApp</string> 
     <key>CFBundleURLSchemes</key> 
     <array> 
      <string>example</string> 
     </array> 
    </dict> 
</array> 

에서

func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool { 
    var returnValue = false 
    let urlString = url.absoluteString 
    print(urlString) 
    if(urlString.hasPrefix("")){ 
     returnValue = true 
    } 
    return returnValue 
} 

그러나 작동하지 않습니다 다음 AppDelegate에에서

합니다. 나는 이메일을 통해 전송하는 링크에서 앱을 열고 싶어한다. 누구나 작동하도록 만드는 아이디어가 있는가?

+1

[다음 예를 따르십시오] (http://stackoverflow.com/documentation/ios/5173/deep-linking-in-ios/19598/adding-a-url-scheme-to-your-own-app # t = 201609071346266107572)을 문서화 하시겠습니까? – FelixSFD

+0

이메일을 통해 어떤 링크를 보내십니까? 예 : // some_path /' – iSashok

+0

예 @iSashok와 같아야하지만 여전히 작동하지 않습니다. –

답변

0

향후 사용자를 위해 @iSashok이 주석에서 언급 한대로 handleOpenURL 함수 is deprecated as of iOS 9. 아이폰 OS의 새로운 버전

당신은 다음과 같은 기능 (Apple Docs)를 사용해야합니다

optional func application(_ app: UIApplication, 
       open url: URL, 
       options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 

당신은 이전과 동일 기능의 몸을 유지 할 수 있습니다, 그리고 지금은 작동합니다.