iOS项目中检测UIWebView并彻底删除

从当前项目看,大概过程分下面几步(可能三,四步大多不会遇到):

检测方法,可以查看.a 文件 framework等搜索不到的地方

1.打开终端 进去到项目目录
2.输入命令 : grep -r UIWebView .//注意有空格和一个点
grep -r UIWebView .  
# 把文件目录下的 不管是第三方还是什么的全部删除了 .  删除保平安  一般这种api 大部分也是过时的

一.搜索项目里的UIWebView并删除干净

1.保险起见注释也尽量不要留了或者实在想保留注释对照“UIWebview”用“旧Webview”来替换
2.需要相应替换成WKWebView看这里;
经历过上面两步希望可见的都被干掉了.


搜索项目中的UIWebView.png

二:第一步也可以看到AFNetworking中包含UIWebView 的分类,MJRefresh里如果有注释升级到最新版

去掉含有UIWebView 的分类
git上给了答案


git
// 把原有替换成下面这样
pod 'AFNetworking', :subspecs => ['Reachability', 'Serialization', 'Security', 'NSURLSession']

1.以上操作结束后,项目会报找不到AFNetWorking文件名的错。
2.使用#import <AFNetworking/AFHTTPSessionManager.h>代替#import "AFNetworking.h"可以解决这个问题。
继续使用终端命令进行检测,如果没有结果,就代表成功了.
MJRefresh升级:

pod 'MJRefresh'一下安装最新版
pod update MJRefresh
当前最新版
Installing MJRefresh 3.4.3 (was 3.1.14.1)

三.隐藏文件.svn里的.svn-base里还能搜索到

./.svn/pristine/69/697d54d65678a7ed32611eacd37204cc1d3c55c8.svn-base:    * [UIWebView01-The drop-down refresh](#UIWebView01-The_drop-down_refresh)
./.svn/pristine/69/697d54d65678a7ed32611eacd37204cc1d3c55c8.svn-base:* `UIScrollView`、`UITableView`、`UICollectionView`、`UIWebView`
./.svn/pristine/69/697d54d65678a7ed32611eacd37204cc1d3c55c8.svn-base:## <a id="UIWebView01-The_drop-down_refresh"></a>UIWebView01-The drop-down refresh
./.svn/pristine/02/023590b8889ac1c807b83e54dfbe97d45e42d131.svn-base:// UIWebView+AFNetworking.h
./.svn/pristine/02/023590b8889ac1c807b83e54dfbe97d45e42d131.svn-base: This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling.
./.svn/pristine/02/023590b8889ac1c807b83e54dfbe97d45e42d131.svn-base:@interface UIWebView (AFNetworking)
./.svn/pristine/d0/d068230d62e8e87b0595f8b9fd89ba21d1a841e7.svn-base:    UIWebView * callWebview = [[UIWebView alloc] init];
./.svn/pristine/be/be4a144707cbc183f6438564ba8327ccc131271e.svn-base:    #import "UIWebView+AFNetworking.h"
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 91A6E7FB4EB09CDE55E06A20D0927842 /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = EC7DB83803F23286B9F0CF31E4D72BA9 /* UIWebView+AFNetworking.m */; };
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       91A6E7FB4EB09CDE55E06A20D0927842 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIWebView+AFNetworking.h"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.h"; sourceTree = "<group>"; };
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       EC7DB83803F23286B9F0CF31E4D72BA9 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIWebView+AFNetworking.m"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.m"; sourceTree = "<group>"; };
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       91A6E7FB4EB09CDE55E06A20D0927842 /* UIWebView+AFNetworking.h */,
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       EC7DB83803F23286B9F0CF31E4D72BA9 /* UIWebView+AFNetworking.m */,
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */,
./.svn/pristine/bc/bc11c11717a8e95804fca5fc413a0196435627a5.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */,
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0C245A5B945EF9E239701ABC1BAF1B /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CF16E29F8925D42064BEBA38B547BAE /* UIWebView+AFNetworking.m */; };
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       1C0C245A5B945EF9E239701ABC1BAF1B /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIWebView+AFNetworking.h"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.h"; sourceTree = "<group>"; };
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       6CF16E29F8925D42064BEBA38B547BAE /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIWebView+AFNetworking.m"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.m"; sourceTree = "<group>"; };
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       1C0C245A5B945EF9E239701ABC1BAF1B /* UIWebView+AFNetworking.h */,
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       6CF16E29F8925D42064BEBA38B547BAE /* UIWebView+AFNetworking.m */,
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */,
./.svn/pristine/73/735d42796ae2ec11cc3ebee5846993cf8e70b712.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */,
./.svn/pristine/10/10cd261cc141bba69af65b53c882d66d1237c1e1.svn-base:    //  We are unable to get textField object while keyboard showing on UIWebView's textField.  (Bug ID: #11)
./.svn/pristine/10/10cd261cc141bba69af65b53c882d66d1237c1e1.svn-base:    //Commented due to #56. Added all the conditions below to handle UIWebView's textFields.    (Bug ID: #56)
./.svn/pristine/10/10cd261cc141bba69af65b53c882d66d1237c1e1.svn-base:    //  We are unable to get textField object while keyboard showing on UIWebView's textField.  (Bug ID: #11)
./.svn/pristine/09/093e7306b5be5d22325a8ea1d9a6447b5675640f.svn-base:// UIWebView+AFNetworking.m
./.svn/pristine/09/093e7306b5be5d22325a8ea1d9a6447b5675640f.svn-base:#import "UIWebView+AFNetworking.h"
./.svn/pristine/09/093e7306b5be5d22325a8ea1d9a6447b5675640f.svn-base:@interface UIWebView (_AFNetworking)
./.svn/pristine/09/093e7306b5be5d22325a8ea1d9a6447b5675640f.svn-base:@implementation UIWebView (_AFNetworking)
./.svn/pristine/09/093e7306b5be5d22325a8ea1d9a6447b5675640f.svn-base:@implementation UIWebView (AFNetworking)
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD2FB4F2F7364B263FC18C2C495011B /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 514AFAB846C27776C3FB7E9F81425405 /* UIWebView+AFNetworking.m */; };
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       0BD2FB4F2F7364B263FC18C2C495011B /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIWebView+AFNetworking.h"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.h"; sourceTree = "<group>"; };
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       514AFAB846C27776C3FB7E9F81425405 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIWebView+AFNetworking.m"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.m"; sourceTree = "<group>"; };
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       0BD2FB4F2F7364B263FC18C2C495011B /* UIWebView+AFNetworking.h */,
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       514AFAB846C27776C3FB7E9F81425405 /* UIWebView+AFNetworking.m */,
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */,
./.svn/pristine/52/52ffe4a425e4aa391f5cb75b93e2ab94e4612956.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */,
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 4441A0285493E249CEB04EE9013D5DC1 /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; };
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D40D1C3FFB6C79E5438BDBF22606730 /* UIWebView+AFNetworking.m */; };
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       4441A0285493E249CEB04EE9013D5DC1 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIWebView+AFNetworking.h"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.h"; sourceTree = "<group>"; };
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       9D40D1C3FFB6C79E5438BDBF22606730 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIWebView+AFNetworking.m"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.m"; sourceTree = "<group>"; };
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       4441A0285493E249CEB04EE9013D5DC1 /* UIWebView+AFNetworking.h */,
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       9D40D1C3FFB6C79E5438BDBF22606730 /* UIWebView+AFNetworking.m */,
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       8958F2453EEBAF71BFEBD78FB48986EC /* UIWebView+AFNetworking.h in Headers */,
./.svn/pristine/e6/e641f0b7a5fbce720561df66ed4b86d2938a76b0.svn-base:       A7F7FDCD36E2DD8D8E346DB19452CC03 /* UIWebView+AFNetworking.m in Sources */,
./.svn/pristine/2c/2c31c5e2c1f278bfb73bba4c37e4be132a75ae3e.svn-base:    UIWebView * callWebview = [[UIWebView alloc] init];
./.svn/pristine/8d/8d59dc373b9d39940d05557b76eb3c9b4e45602f.svn-base:link ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
Binary file ./.svn/wc.db matches
./Pods/MJRefresh/README.md:    * [UIWebView01-The drop-down refresh](#UIWebView01-The_drop-down_refresh)
./Pods/MJRefresh/README.md:* `UIScrollView`、`UITableView`、`UICollectionView`、`UIWebView`
./Pods/MJRefresh/README.md:## <a id="UIWebView01-The_drop-down_refresh"></a>UIWebView01-The drop-down refresh
Binary file ./TruckDispatcher.xcworkspace/xcuserdata/liuffsunny.xcuserdatad/UserInterfaceState.xcuserstate matches
Binary file ./TruckDispatcher.xcworkspace/xcuserdata/zhonghua.xcuserdatad/UserInterfaceState.xcuserstate matches

如下图:是这个隐藏文件惹的祸,因为我们项目里用的是git管理,所以svn应该是误操作加上的也会跟踪代码的修改,所以我删除的时候有1788个,删除后项目一切正常.

image.png

删除.svn隐藏文件.png

四.继续检测发现如下还有两个存在的地方

检测.png

涉及到的问题就是git中如何忽略project.xcworkspace/xcuserdata/username.xcuserdatad/userinterfacestate.xcuserstate文件
1.你是否写了.gitignore文件。Git中有一个.gitignore配置文件,在这个文件中可以设置被忽略的文件,假如你在工程中写了一个小的脚本,只想自己使用而不用提交到远端进行管理,那你就可以在.gitignore文件中进行配置。我们一般只对某一个特定的工程进行一些文件的忽略,所以只需要在工程中的代码目录下添加这个文件即可。在你确定有这个文件并且加入了下面的忽略信息,那就需要清理缓存了。

*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate

2.因为project.xcworkspace/xcuserdata/username.xcuserdatad/userinterfacestate.xcuserstate文件已经出现,那么我们就要清理这个缓存文件才能避免这个文件每次都出现,清理这个缓存,你可以用命令行

git rm --cached [YourProjectName].xcodeproj/project.xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate

或者直接找到你的工程目录project.xcworkspace,由于project.xcworkspace是一个包文件,直接显示包内容,找到UserInterfaceState.xcuserstate移到废纸篓就行了。(我简单粗暴的先用的这个)

然后打开把你的修改,commit,push。修改的过程中,最好把xcode退出,避免你删除UserInterfaceState.xcuserstate之后又会生产,造成忽略失败。
走到这里,再次去检测,终于没有了,完成.


最终检测.png
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,937评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,503评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,712评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,668评论 1 276
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,677评论 5 366
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,601评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,975评论 3 396
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,637评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,881评论 1 298
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,621评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,710评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,387评论 4 319
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,971评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,947评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,189评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 44,805评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,449评论 2 342