2015-05-15 23 views
1

我目前正在嘗試在Salesforce中創建一個RESTful API,並且我在iOS部分中遇到了一些問題。這裏是我一直在嘗試使用的swift代碼,但是我收到了NOT_FOUND 404錯誤消息,「請求的資源不存在」。使用SFRestAPI與Swift的Webservice

let getRequest: SFRestRequest = restAPI.performRequestWithMethod(SFRestMethodGET, path: "/services/apexrest/(service name here)/", queryParams: nil, failBlock: { 
     error in 
      println(error) 
     }, completeBlock: { 
     response in 
      println(response) 
    }) 

我能得到其他SOQL查詢到我的iOS應用中工作,並且用戶可以登錄就好了,我想我可能在問候是稍離開打電話給我的Apex Web服務。

任何建議/意見,非常感謝!謝謝!

回答

2

該解決方案最終被

var request = SFRestRequest(method: SFRestMethodGET, path:"/services/apexrest/CustomRestWebservice/", queryParams:nil) 

request.endpoint = "" 

restAPI.sendRESTRequest(request, failBlock: {error in println(error)}, completeBlock: { response in println(response) }) 

端點默認爲字符串,它是不是你想要的,所以你必須將它設置爲無,以得到正確的結果手動。