2016-11-08 2 views
0

초보자 용서해주십시오. 완료 처리기로이 함수가 있지만 함수가 완료되면 호출되지 않습니다. 어떤 팁? 완료 처리기가 호출되지 않았습니다.

func updateDailyLength(completion:()-> Void) { 
      //do something here 
    } 

그리고 발신자에 감사

:

updateDailyLength(completion: { getMonthlyDistance() }) 

이 기능 getMonthlyDistance()가 호출되지 않습니다.

답변

7

당신은 당신은 updateDailyLength() 함수에 완료 핸들러를 호출 할 필요가 updateDailyLength

func updateDailyLength(completion:()-> Void) { 
     completion() 
} 
0
func updateDailyLength(completion:()-> Void) { 
     completion() 
} 


updateDailyLength(completion: { getMonthlyDistance() }) 

에서 호출 할 필요가있다. getMonthlyDistance()와 같은 매개 변수로 함수를 호출하면 완료 대신에 호출됩니다()

관련 문제