我不是污王,我是坑王-iOS bug汇总

前言:

我不是污王,我是坑王,当你成为iOS开发者的一员的时候,你就要准备接受这一点,无处不在的坑,就像无处不在的污一样,我们要和他们成为好朋友,一起奋斗,并永远快乐的在一起。

问题1:
打包遇到的问题ERROR ITMS-4238: "Redundant Binary Upload. There already exists a binary upload with build version '3' for train '2.1.0'" at SoftwareAssets/PreReleaseSoftwareAsset

解决办法
改一下build就好,没打包一次需要改变一次,截图为证
```
![3A8CD68F-42AA-4289-837F-44372800FB85.png](http://upload-images.jianshu.io/upload_images/616981-be9d636111a4e825.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

问题2:
使用权限 [com.apple.developer.in-app-payments] 的 App 必须为[Simplified Chinese]提供隐私政策网址(URL)。如果您的 App 不使用这些权限,请将它们从您的 App 中移除并上传新的二进制文件。

解决办法:
(1),闲的蛋疼是自己害自己,导致应用审核被驳,记住demo才是王道,不要以后后期公司会加入某个功能而提前merge代码
(2),删除集成apple pay相关证书后,关闭apple pay设置开关,后会再上传apple store

问题3:
添加第三方类库造成的linker command failed with exit code 1 (use -v to see invocation)的错误调试
Undefined symbols for architecture i386:  
  "_OBJC_CLASS_$_FMDatabase", referenced from:  
      objc-class-ref in ViewController.o  
ld: symbol(s) not found for architecture i386  
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

![D3611395-233C-4387-ACBA-0D4A039E7069.png](http://upload-images.jianshu.io/upload_images/616981-92c6e7fcf6581848.png)
 
解决办法:

在工作左边导航栏Target-->Build Phases-->compile Sources中,第三库库的所有.m文件都添加到里面,然后编译通过了;

![9EB2AD4E-B037-499D-A057-C361C9BC4DD9.png](http://upload-images.jianshu.io/upload_images/616981-67fa4fd75e52dd54.png)



添加.m文件

![A23B96B6-DB63-4CCD-B330-129229F9AB75.png](http://upload-images.jianshu.io/upload_images/616981-b7c01307695edff7.png)

对于以上错误,根据网友解答我的理解是
我们在使用这些第三方类库文件时直接将其拖拽到工程之中,编译的的时候Xcode也没有自动引用,所以造成这样错误,这就需要我们手动添加。假如我们在工程中新建某个文件就不会出现这样问题;

问题4:
[app上传APP Store报错:ERROR ITMS-90086:"missing 64-bit support.]
bug描述:

**ERROR ITMS-90086:"missing 64-bit support.** beginning on february 1, 2015, new [iOS](http://lib.csdn.net/base/1) apps submitted to the app store must be include 64-bit support and be built with the ios8 SDK......


![AE88B06C-A049-4C30-93B5-51AECE4A663E.png](http://upload-images.jianshu.io/upload_images/616981-b2d45b6ac9839164.png)


解决办法:
这是因为现在提交的app必须支持64位,
但是使用cocospod时,在Podfile文件里面加上:
   post_installdo |installer| installer.project.targets.eachdo |target| target.build_configurations.eachdo |config| config.build_settings['ARCHS'] ="armv7 arm64" end end end

![0B18F0A0-7166-4D73-9942-BEB80DFF728E.png](http://upload-images.jianshu.io/upload_images/616981-f92d289a0ebcf42f.png)

问题5:
iOS内存错误EXC_BAD_ACCESS的解决方法

解决办法:


![B982F525-4B0D-4D8C-B900-43B7A224CCAC.png](http://upload-images.jianshu.io/upload_images/616981-38de26df2f7cd212.png)



问题6:
Xcode在项目更名之后,把项目转移到其他机器出现ld: file not found: /Users/macmini/Library/Developer/Xcode/DerivedData/t的问题

![131C0F44-CF35-4393-8596-FF3ED135D374.png](http://upload-images.jianshu.io/upload_images/616981-6c179866c6b59082.png)

解决办法:
这是因为项目更改工程名导致的问题,我们需要删除TARGETS  ->hrb-iOS **Tests** 文件即可

![174A42AC-CCFD-4644-822F-EEC5590FC647.png](http://upload-images.jianshu.io/upload_images/616981-4bc834f30244a27e.png)


问题7:
ld: library not found for -lHMSegmentedControl
clang: error: linker command failed with exit code 1

解决办法:
1),把Build Active Architecture Only   设为Yes,截图如下

![46D29C91-64CE-4A10-AEF8-3556AA0499BD.png](http://upload-images.jianshu.io/upload_images/616981-3fc76ea22a08ea64.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


问题8:这个不是问题啦,是如何添加pch文件
Xcode6为什么干掉pch(Precompile Prefix Header)&如何添加pch文件

解决办法:
简单地看:我们在写项目的时候,大部分宏定义,头文件导入都在这里,Xcode6去掉Precompile Prefix Header的主要原因可能在于Prefix Header大大的增加了Build的时间。没有了Prefix Header之后就要通过手动@import来手动导入头文件了,在失去了编程便利性的同时也降低了Build的时间。具体原因
StackOverFlow上讨论的已经比较清晰了
[StackOverFlow:为什么xcode6没有自动创建pch文件呢?](http://stackoverflow.com/questions/24158648/why-isnt-projectname-prefix-pch-created-automatically-in-xcode-6)

如何在Xcode6中添加pch(Precompile Prefix Header)?
1,Command+N,打开新建文件窗口:ios->other->PCH file,创建一个pch文件:“工程名-Prefix.pch”:

![ECF5DA7A-EB59-4760-BC33-5E1EB5B970BA.png](http://upload-images.jianshu.io/upload_images/616981-54fe71ce1c8a8afd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2,将building setting中的precompile header选项的路径添加“$(SRCROOT)/项目名称/pch文件名”(例如: )

![B92AEE15-3F87-40E6-BC68-C81B2E7B7689.png](http://upload-images.jianshu.io/upload_images/616981-0a979e1811a4f402.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
可以了,编译一下程序,如果有错误检查一下添加的路径是否正确。

3,将Precompile Prefix Header为YES,预编译后的pch文件会被缓存起来,可以提高编译速度

![4E3E2471-551E-4AD0-9CDA-ECBE8D37C5CE.png](http://upload-images.jianshu.io/upload_images/616981-cfad0aad6d4c34e2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


问题9:
iOS开发证书及打包问题,这个问题比较蛋疼,用了蛮长的时间在网上查找才解决,下面的方法不错,保存

解决办法:
一、证书选择:
在iOS开发是经常需要打包给测试,打包需要匹配的证书(Certificates)和描述文件(Provisioning Profiles)。在工程PROJECT和TARGET的Build Srttings里Code Signing选择对应的证书和描述文件:

![BE4FAB22-C0EB-46E1-A389-88DAF0EB6458.png](http://upload-images.jianshu.io/upload_images/616981-bc96bcfc2b966d45.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

在Provisioning Profiles里选择描述文件,一般有三种:<喎�"http://www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\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\">

一般证书和描述文件取名时默认用项目名称+对应的功能缩写,向上边一样,tianxiangADHoc就是线上测试环境证书,tianxiangDistribution就是发布AppStore时选择的证书,tanxiangdev就是测试环境证书。

Code Signing Identily 就是对应的证书,一般选Automatic即可,Xcode会自动帮你匹配合适的证书,但是注意PROJECT和TARGET里都需要改。

二、自动编译打包:

在选好证书和描述文件后,下边就可以打包,这里还有一个要注意,如果工程中用到DLog,提交AppStore时需要在Edit Scheme里边Archive下的Build Configuration改成release模式,这样log就不会在后台输出:

![7C37031C-D3E0-4C48-99E6-A0F64A4ECB5A.png](http://upload-images.jianshu.io/upload_images/616981-39efc923c48a3195.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

打包编译时需要选择设备,就不能再用iOS Simulator,需要选你的测试机或者如果没测试机就选择ios Device,然后在导航栏Product下选择Archive,之后Xcode就会自动打包:

![BA7AF878-53FC-45B7-A11A-FA5D93737820.png](http://upload-images.jianshu.io/upload_images/616981-2b3e7165f3d7b521.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

打包完成后会自动弹出如下界面:

![BB0E5B62-4B5F-49CD-811E-E2AF1B7B439F.png](http://upload-images.jianshu.io/upload_images/616981-aa0b808a1ec211eb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
然后点击Distribution,下边会有3个选项:
![C84DB150-770D-444B-87F9-05EBF3A8777B.png](http://upload-images.jianshu.io/upload_images/616981-b96482681649b357.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

第一个选项是你正式提交AppStore审核时候选择的,第二个选项是给测试打包时候选择的,第三个选项后生成一个后缀为.xcarchive的文件,然后导出ipa包的。选完第二项之后还会弹出让你选择描述文件,这时候你就可以根据需要选择dev还是ADHoc,但是需要跟之前在工程里选的证书描述文件一致:

![0F55F7CB-BD0A-4835-B32F-77DE38429FCA.png](http://upload-images.jianshu.io/upload_images/616981-0382e82c3168089e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

选好后选择Export导出,然后给包一个命名选择一个保存在哪里,点击Save打包就算完成了:

![6B20F630-867D-465E-80F2-8E1C4780D216.png](http://upload-images.jianshu.io/upload_images/616981-de979a5c47f41557.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

后记:Xcode里已经集成Apple开发者账户功能,你只用输入开发者账号和密码他会帮你自动download证书和描述文件。

![44406B4D-A98C-477F-A735-3CB42A4E64EE.png](http://upload-images.jianshu.io/upload_images/616981-b99d45dd32ae3b01.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

点击Xcode选择Preferences:

然后点击Accounts,输入你的Apple iD和密码,然后点击View Details里:

然后点击左下角刷新按钮,刷新完后点击Done即可,上边是证书,下边是描述文件,每次添加完新设备后,也需要在这里重

![6DD99195-95AD-481C-9EC9-4C96491B6908.png](http://upload-images.jianshu.io/upload_images/616981-6fc26ad5a93a4549.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

Down一下证书:

![C379D2FE-78FD-426C-A612-526902092F5A.png](http://upload-images.jianshu.io/upload_images/616981-5f4c30a35b949fd7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


问题10:
xcode每次debug的时候,都进入汇编代码
![6C07DFBA-262C-4AE8-90CD-5E72930D90CD.png](http://upload-images.jianshu.io/upload_images/616981-844ae5907ac8ebab.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

解决办法:
Debug —>Debug Workflow —> 把always show disassembly 的勾去掉就行

![F143D36E-FBAB-4A3B-84ED-C36F09012E72.png](http://upload-images.jianshu.io/upload_images/616981-0cf9067373d623fb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


问题11:
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)

//终端提示
appledeiMac:~ apple$ pod install 
提示:
[!] The `GuoHongHui [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `GuoHongHui [Release]` target overrides the `LIBRARY_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation    - Use the `$(inherited)` flag, or    - Remove the build settings from the target.

解决办法:
在Bulid Settings  -> Other Linker Flags 和 PODS_ROOT  and  LIBRARY_SEARCH_PATHS 中添加  $(inherited)
要不然编译通不过

问题12:
//pods出现问题
ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决办法:
在Bulid Settings ->

![A433605E-B3B2-40E0-914C-F543C6C9BD93.png](http://upload-images.jianshu.io/upload_images/616981-7ac65473eb846321.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
注释:每次导入出现此问题都需要调整

问题13:
//pod出现问题
 /Users/apple/Library/Developer/Xcode/DerivedData/GuoHongHui-cuoamtvlplnyltahdisjznadwpqm/Build/Products/Debug-iphonesimulator/libPods-SDWebImage.a(SDWebImagePrefetcher.o)
ld: 74 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决办法:
重复导入SDWebImage,删除多余的

问题14:
//pod警告
ld: warning: directory not found for option '-L/Users/apple/Desktop/GuoHongHui/GuoHongHui/Public/UMAnalytics_Sdk_3.5.9'

解决办法:
选择工程, 编译的 (targets)
选择 Build Settings 菜单
查找 Library Search Paths 和 Framework Search Paths, 删掉编译报warning的路径即OK


问题15:
//pod出现问题
**[ruby]** [view plain](http://blog.csdn.net/dqjyong/article/details/37958067#)[copy](http://blog.csdn.net/dqjyong/article/details/37958067#)

最新对mac 10.10的强大功能好奇,于是将系统升级到了10.10,结果发现使用pod出现了下面的问题:  

**[ruby]** [view plain](http://blog.csdn.net/dqjyong/article/details/37958067#)[copy](http://blog.csdn.net/dqjyong/article/details/37958067#)

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:6:in `rescue in <top (required)>'  
    from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:3:in `<top (required)>'  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj.rb:30:in `<top (required)>'  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods.rb:2:in `<top (required)>'  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:32:in `<top (required)>'  
    from /usr/bin/pod:23:in `load'  
    from /usr/bin/pod:23:in `<main>'  

解决办法:  
1. 打开 Xcode 6  
2. 进入 Preferences 
 3. 点击Locations选项 
 4. 将 Command Line Tools 版本变成 Xcode 6.0 
 5. 卸载 cocoapods,在终端中输入 
$ sudo gem uninstall cocoapods  
  6. 安装xcodeproj,在终端中输入
$ sudo gem install xcodeproj  
  7. 安装cocoapods,在终端中输入
$ sudo gem install cocoapods  
  8. 测试pod是否安装成功,在终端中输入
$ pod --version   
  

问题16:
"_OBJC_CLASS_$_XSExecutionSummaryDetailViewController", referenced from: objc-class-ref in XSExecutionSummaryViewController.o (bug处理)
Undefined symbols for architecture i386:  "_OBJC_CLASS_$_XSExecutionSummaryDetailViewController", referenced from:      objc-class-ref in XSExecutionSummaryViewController.old: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

_OBJC_CLASS_$_Play", referenced from
  遇到的问题:"_OBJC_CLASS_$_Play", referenced from:
![79612D55-43CD-4EFD-BF95-78EE197EF26B.jpg](http://upload-images.jianshu.io/upload_images/616981-4798db3247f862a8.jpg)

解决办法:
  Tagert--Build Phases -- Compile Sources 下添加对应的.m文件
![6154A92A-414D-4929-85C0-35DB1998B3E6.png](http://upload-images.jianshu.io/upload_images/616981-3a444c96e03f8265.png)

问题17:
高德地图添加手势不响应
使用场景,我们公司需要做一个类似房多多点击地图 -- 查看周边配套的效果,测试后高德好像屏蔽了该手势,所以实现下面代理方法去实现

解决办法:

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDidClick)];
tap.delegate = self;
[self.mapView addGestureRecognizer:tap];
//ios开发中,默认是在同一时间只能有一个手势被执行,要实现多个手势同时进行,须实现

  • (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
    }

  • (void)tapDidClick
    {
    NSLog(@"tapDidClick");
    }

问题18:
tableView在没有数据的时候去掉分割线

解决办法:

self.listTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.listTableView.tableFooterView = [UIView new];


问题19:
tableView的局部刷新问题

解决办法:

//局部section刷新
NSIndexSet * nd=[[NSIndexSet alloc]initWithIndex:1];//刷新第二个section
[tview reloadSections:nd withRowAnimation:UITableViewRowAnimationAutomatic];
//局部cell刷新
NSIndexPath *te=[NSIndexPath indexPathForRow:2 inSection:0];//刷新第一个section的第二行
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:te,nil] withRowAnimation:UITableViewRowAnimationMiddle];


问题20:
用按钮做倒计时的时候,有时候会出现btn上的数值是抖动的,如何解决

解决办法:

这个问题网上答案比较难搜索,是无意识尝试得到的结果,其实只要把 按钮的类型设置为 UIButtonTypeCustom ,即可

问题21:
在界面上滚动一个scrollview,那么我们会发现在停止滚动前,控制台不会有任何输出,就好像scrollView在滚动的时候将timer暂停了一样

解决办法:

解析:
在查看相应文档后发现,这其实就是runloop的mode在做怪。runloop可以理解为cocoa下的一种消息循环机制,用来处理各种消息事件,我们在开发的时候并不需要手动去创建一个runloop,因为框架为我们创建了一个默认的runloop,通过[NSRunloop currentRunloop]我们可以得到一个当前线程下面对应的runloop对象,不过我们需要注意的是不同的runloop之间消息的通知方式。
接着上面的话题,在开启一个NSTimer实质上是在当前的runloop中注册了一个新的事件源,而当scrollView滚动的时候,当前的MainRunLoop是处于UITrackingRunLoopMode的模式下,在这个模式下,是不会处理NSDefaultRunLoopMode的消息(因为RunLoop Mode不一样),要想在scrollView滚动的同时也接受其它runloop的消息,我们需要改变两者之间的runloopmode.
代码:
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

问题22:
连接SSH报错REMOTE HOST IDENTIFICATION HAS CHANGED
错误样式
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host isda:f7:3e:ba:f7:00:e6:44:76:f2:58:6e:48:******.
Please contact your system administrator.Add correct host key in /用户home目录/.ssh/known_hosts to get rid of this message.
Offending RSA key in /用户home目录/.ssh/known_hosts:1RSA host key for ip地址 has changed and you have requested strict checking.Host key verification failed.

解决办法:
  1. cd ~/.ssh
  2. ssh-keygen -R git.corp.com
  3. ssh-keygen -l -f ~/.ssh/known_hosts

问题23:
对一个已经释放的对象进行release操作,造成的内存错误EXC_BAD_ACCESS

解决办法:

通过Product->Scheme->Edit Scheme进入下面编辑页面,选中Arguments tab,增加标计位NSZombieEnabled设为YES

截图如下:
![FFF5E8AF-A38F-4500-AD6B-07CDC8CFE345.png](http://upload-images.jianshu.io/upload_images/616981-8d77bb1881c223a4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

问题24:
兼容性问题,无法兼容iPhone5和iPhone 5c
![FEABF44EDFAB3990F705630674A61D47.png](http://upload-images.jianshu.io/upload_images/616981-ade2739580384311.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


解决办法:
将 Build Active Architectures Only 选项在Debug模式都设成YES,Release模式都设成NO。
截图如下:

![668416A9-551F-471A-BCB4-8BF92FF9C416.png](http://upload-images.jianshu.io/upload_images/616981-56638e2ecffd52f6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


问题汇总还在继续,我们还在努力啊,我不是污王,我是坑王。


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

推荐阅读更多精彩内容