2016-12-26 2 views
0

이 내 스위프트 3 코드 :왜 'Subscript'회원에 대한 모호한 참조입니까?

그것은 말한다 컴파일 타임 오류가 발생
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
    if let userInfo : Foundation.NSDictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? Foundation.NSDictionary { 
     self.setNavigationInfoFromPushNotification(userInfo: userInfo) 
     navigateFromPushNotification() 
    } 
    ... 
} 

:

회원에게

참조가 모호 '첨자'

사람이 도움이 될 수 있습니다하십시오 이걸로 나?

+0

예,이 코드는 didFinishLaunchingWithOptions입니다. – Megha

+1

'didFinishLaunchingWithOptions'에 대한 현재 메소드 서명을 포함시킬 수 있습니까? – Keiwan

+0

@Rob 그렇지 않을 수도 있습니다. http://stackoverflow.com/questions/40209234/how-to-handle-launch-options-in-swift-3-when-a-notification-is-tapped-getting-s – Keiwan

답변

1

메서드 서명이 변경되었습니다. How to handle launch options in Swift 3 when a notification is tapped? Getting syntax problems을 참조하십시오.

지금이다 :

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { 
    if let userInfo = launchOptions?[.remoteNotification] as? NSDictionary { 
     setNavigationInfoFromPushNotification(userInfo: userInfo) 
     navigateFromPushNotification() 
    } 
    ... 
} 
관련 문제