2012-06-12 24 views
0

嗨,我正在以下錯誤在此代碼 /* 類:CreateMobileChatterCntrl 說明:郵政顫振的聯繫。 製作人:哈里什卡特里(Appirio公司離岸) 創建日期:2012年6月2日 */人品沒有可行的替代方案「」

public without sharing class CreateMobileChatterCntrl { 
    public final Id ContactID{get;set;} 
    public String message{get;set;} 
    public boolean isSuccess{get;set;} 
    public boolean throwError{get;set;} 
    public String deviceType{get;set;} 
    //----------------------------------------------------------------------------  
    //constructor 
    //---------------------------------------------------------------------------- 
    public CreateMobileChatterCntrl() { 
    throwError = false; 
    isSuccess = false; 
    if(ApexPages.CurrentPage().getParameters().get('id') != null){ 
     ContactID = ApexPages.CurrentPage().getParameters().get('id'); 
    } 
    String userAgent = ApexPages.currentPage().getHeaders().get('USER-AGENT'); 
    if(userAgent.contains('iPhone')) 
     deviceType = 'iPhone'; 
    //else if(userAgent.contains('Android')) deviceType = 'Android'; 
    } 
    //----------------------------------------------------------------------------  
    // Post the chatter on contact 
    //---------------------------------------------------------------------------- 
    public Pagereference save() { 

    if(message == null || message ==''){ 
     throwError = true; 
     return null; 
    } 

    FeedItem feedItem = new FeedItem(); 
    feedItem.ParentId = ContactID; 
    feedItem.Body = message; 

    try { 

     insert feedItem; 
     isSuccess = true; 

    } catch(Exception e){} 
    return null;//new PageReference('/' + ContactID); 
    } 

    public Pagereference cancel() { 
    return new PageReference('/' + ContactID); 
    } 
} 

公衆最終標識的ContactID {獲取;集;}在這行我得到的錯誤沒有可行的替代方案,在字符''。可以任何人請幫助爲什麼我得到這個錯誤?

回答

8

你的類文件中的一些單引號字符是無效的 - 也許是因爲你從其他地方複製並粘貼了代碼。在我從別處複製代碼之前,我曾經多次發生過這種情況。從引用中的消息開始:message =='',我會刪除單引號,重新鍵入它們,然後重新保存文件。重複所有單引號(或做一個查找和替換)。

+0

如果錯誤的單引號在視覺上相同,但使用了不同的代碼點,查找和替換將不起作用。 – jpaugh