2013-12-13 2 views
0

방금 ​​루비 모션을 배우기 시작했고 튜토리얼 시작 부분에 도로 블록을 맞았습니다! 튜토리얼은 "RubyMotion iOS Development Essentials"입니다.RubyMotion 오류

여기 내 코드입니다 : 내가 들여 쓰기 재미 보인다 알고

class RootController < UIViewController 
    def viewDidLoad 
    alert = UIAlertView.alloc.initWithTitle "This is foo title", 
    message:"Do you like this example?", 
    delegate: nil, 
    cancelButtonTitles: "cancel", 
    otherButtonTitles: "Yes", "No", nil 
    alert.show 
    end 
end 

,하지만 분명히 그 이상한 RubyMotion 구문 ..., 나는 알고있다. 그리고 여기에 내가 "initWithTitle"방법에 대해 수신하고있는 오류입니다 :

(main)> 2013-12-13 00:44:40.780 HelloWorld[97435:80b] root_controller.rb:7:in `viewDidLoad': undefined method `initWithTitle' for #<UIAlertView:0x8d2bcf0> (NoMethodError) 
    from app_delegate.rb:6:in `application:didFinishLaunchingWithOptions:' 
2013-12-13 00:44:40.782 HelloWorld[97435:80b] root_controller.rb:7:in `viewDidLoad': undefined method `initWithTitle' for #<UIAlertView:0x8d2bcf0> (NoMethodError) 
    from app_delegate.rb:6:in `application:didFinishLaunchingWithOptions:' 
2013-12-13 00:44:40.784 HelloWorld[97435:80b] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'root_controller.rb:7:in `viewDidLoad': undefined method `initWithTitle' for #<UIAlertView:0x8d2bcf0> (NoMethodError) 
    from app_delegate.rb:6:in `application:didFinishLaunchingWithOptions:' 

'

내가 어떤 포인터를 감사하겠습니다, 그것은 초기에이 붙어 얻을 수있는 주요 안됐다!

+0

RubyMotion은 RUBY를 사용하여 개발할 수있는 툴체인이므로 코드를 들여 쓰는 방식 (Ruby 코드)이 적절하지 않은 방법 (보통 더 읽기 쉬운 방법)입니다. 추적을 보면'initWithTitle' 메소드 정의가 누락 된 것 같습니다. 'p UIAlertView.alloc.methods'를 실행하여 이미 다른 이름으로 정의되어 있는지 확인하십시오. – yeyo

+0

@kira, 메서드가 이미 정의되어 있습니다. initWithTitle : message : delegate : cancelButtonTitle : otherButtonTitles : –

답변

2

cancelButtonTitlescancelButtonTitle이어야합니다.

여러 단어를 사용하고 있기 때문에 일치하는 서명 서명을 찾을 수 없습니다.