我希望有快速类型建议,以便在uitextview中打开键盘时将我自己的某些应用程序级别所需的短语作为建议.
例如,如果用户键入"All" - 在quicktype suggesstion中我想显示"All is well"或"All is is expected".
我可以自定义quicktype建议文本吗?
如果没有,那么可以通过其他方式将这些建议显示在键盘打开时.
我的NSString是这样的:
NSString *myString =
(
“\n \n 24 K CLUB”,
“\n \n 3 DOLLAR CAFE”,
“\n \n A PEACH OF A PARTY”,
“\n \n A ROYAL AFFAIR CAFE”,
“\n \n AFFAIRS TO REMEMBER CATERERS”,
“\n \n AFRIKAN DELI” )
Run Code Online (Sandbox Code Playgroud)
如何摆脱这个新行字符和空格,以便我的新字符串如下: newString:
(
"24 K CLUB”,
"3 DOLLAR CAFE”,
“A PEACH OF A PARTY”,
“A ROYAL AFFAIR CAFE”,
“AFFAIRS TO REMEMBER CATERERS”,
“AFRIKAN DELI”
)
Run Code Online (Sandbox Code Playgroud)
我试过了 :
myString = [myString stringByReplacingstringByReplacingOccurrencesOfString:@"\n" withString:@""];
myString = [myString stringByReplacingstringByReplacingOccurrencesOfString:@" " withString:@""];
Run Code Online (Sandbox Code Playgroud)
但没有成功..忘记错误:
[__NSArrayI stringByReplacingOccurrencesOfString:withString:]: …Run Code Online (Sandbox Code Playgroud) 有人可以帮助我理解和解决我在连接到Web服务时遇到的错误:
NSURLError是:Domain = NSURLErrorDomain Code = -1005"网络连接丢失." NSErrorFailingURLStringKey = http:// username:password @ .. org:443/zws/xmlrpc/restricted1 /,NSErrorFailingURLKey = http:// username:password @ .. org:443/zws/xmlrpc/restricted1 /,NSLocalizedDescription =网络连接丢失.,NSUnderlyingError = 0x5f2b300"网络连接丢失.
我正在访问一个Web服务并在尝试连接时收到此错误(Web服务是XMLRPC,我使用wordpress xmlrpc源代码请求和处理repsonse):
错误域= NSURLErrorDomain代码= -1202"此服务器的证书无效.您可能正在连接到假装为" ** .org" 的服务器,这可能会使您的机密信息面临风险."
WebService的人说要忽略证书验证部分,所以如果有人知道怎么做,那将对我有很大的帮助.
在一些建议之后我使用了下面的NSURLConnection委托,stil同样的错误
-(BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
if ([trustedHosts containsObject:challenge.protectionSpace.host])
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
Run Code Online (Sandbox Code Playgroud)