Salesforce 角色“”处没有可行的替代方案
嗨,我在这段代码中得到了以下错误 /* 类别:CreateMobileCharterCentrl 描述:触点上的后颤振。 开发人:Harish KhatriAppirio Offshore 创建日期:2012年6月2日 */Salesforce 角色“”处没有可行的替代方案,salesforce,apex-code,Salesforce,Apex Code,嗨,我在这段代码中得到了以下错误 /* 类别:CreateMobileCharterCentrl 描述:触点上的后颤振。 开发人:Harish KhatriAppirio Offshore 创建日期:2012年6月2日 */ public final Id ContactID{get;set;}在这一行,我在字符“”处遇到了错误。没有可行的替代字符。有人能帮我解释一下为什么会出现此错误吗?类文件中的一些单引号字符无效,可能是因为您从其他地方复制并粘贴了代码。当我从其他地方复制代码时,这种情况已经
public final Id ContactID{get;set;}在这一行,我在字符“”处遇到了错误。没有可行的替代字符。有人能帮我解释一下为什么会出现此错误吗?类文件中的一些单引号字符无效,可能是因为您从其他地方复制并粘贴了代码。当我从其他地方复制代码时,这种情况已经发生过很多次了。从:message==中的引号开始,我将删除单引号,重新键入它们,然后重新保存您的文件。对所有单引号重复此操作,或者执行查找和替换。如果错误的单引号外观相同,但使用了不同的代码点,则查找和替换将不起作用。
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);
}
}