AFJSONRequestOperation不支持”text/html”问题

问题描述:输入法用AFJSONRequestOperation获取服务器更新消息。发现AFNetworking示例可以使用,换了服务器访问地址就不行了。

问题分析:打印出错误消息,如下:

Error Domain=AFNetworkingErrorDomain Code=-1016 "Expected content type {(
"text/json",
"application/json",
"text/javascript"
)}, got text/html"

看来是AFJSONRequestOperation只支持3种META,而服务器返回的是"text/html"。

问题解决:增加如下代码,让AFJSONRequestOperation支持"text/html"。

[AFJSONRequestOperationaddAcceptableContentTypes:[NSSetsetWithObjects:@"text/html", nil]];

UITableView的insert和delete操作与numberOfRowsInSection同步问题

问题描述:通过CrashRepoter得到如下报错信息:
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 3 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

问题解决:在[self.tableView insertRowsAtIndexPaths:withRowAnimation:]和[tableView deleteRowsAtIndexPaths:withRowAnimation:]进行修改的操作前后加保护:
[tableView beginUpdates]和[self.tableView endUpdates]

Xcode升级导致插件失效

问题描述:Xcode升级后有些插件失效

问题分析:在控制台中查看log,显示是白名单问题

问题解决:把Xcode的UUID加入插件plist中:
XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
defaults write ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/HOStringSense.xcplugin/Contents/Info DVTPlugInCompatibilityUUIDs -array-add $XCODEUUID