2014-12-27 4 views
3

Pinterest-IOS SDK (2.3) 사용 Swift Bridge를 통해 SDK의 인스턴스를 만들고 createPinWithImageURL을 호출 할 때 EXC_BAD_ACCESS 오류가 발생합니다. 동일한 코드를 다시 objective-c로 변환 한 다음 Swift에서 래퍼 메서드를 호출하면 예상대로 작동합니다. 근본 원인은 Swift에서 appID 및 suffix 문자열을 Objective-C로 전달하는 것 같습니다.Pinterest-IOS 2.3 및 Swift : createPinWithImageURL을 호출하면 EXC_BAD_ACCESS가됩니다.

이 코드는 실패

Sample Project

: 나는이 방법을 보여줍니다 프로젝트를 만든

self.bainterest = PinterestWrapper.sharedInstance() 
    baPinterest.pinRecipe(imageUrl, sourceURL:sourceUrl, description:pinDescription) 

: 목적-C 측에 APPID을 설정할 때 성공

self.pinterest = Pinterest(clientId:"your_app_id", urlSchemeSuffix:"prod")! 
if(pinterest.canPinWithSDK()) { 
    pinterest.createPinWithImageURL(NSURL(string: imageUrl)!, sourceURL:NSURL(string: sourceUrl)!, description:pinDescription) 
} 

+0

코드가 작동됩니다. 감사합니다. – Rawan

답변

4
 var pinterest:Pinterest = Pinterest() 
     pinterest.setValue("your_app_id", forKey: "clientId") 
     if(pinterest.canPinWithSDK()){ 
      pinterest.createPinWithImageURL(imageUrl, sourceURL:sourceUrl, description:pinDescription) 
     } 

funziona correttamente

+0

설명문 – tod

+1

왜 작동하는지 알지 못하지만, 스위프트에서는 작동합니다. – AutomatonTec

+0

@raffaele 안녕하세요 어디에서 내 애플 리케이션 ID를 얻을 수 있습니까? 설명서의 : https://developers.pinterest.com/ios/ 필요하지 않습니다. 감사합니다 :) – Rawan