iOS遇到问题小总结

JSON

Invalid type in JSON write (NSConcreteMutableData)
合法的json对象:

  • 1、顶层对象必须是NSArray或者NSDictionary;
  • 2、所有的对象必须是NSString/NSNumber/NSArray/NSDictionary/NSNull的实例;
  • 3、所有NSDictionary的key必须是NSString类型;
  • 4、数字对象不能是非数值或无穷;

内购

1、银行cnaps code查询

http://www.lianhanghao.com/

2、申请账号时,无法加入program

苹果说:

Sorry, you can’t enroll at this time. You can still develop apps and test them on iOS devices using the beta version of Xcode. Learn more

原因: 按照注册的时候填写的出生日期, 年龄未满18岁。
解决方法:

  • 重新注册apple id;
  • 在apple.com修改appid的信息;

iOS10

1、未找到应用程序的“aps-environment”的授权字符串

"getting push token failed: Error Domain=NSCocoaErrorDomain Code=3000 "未找到应用程序的“aps-environment”的授权字符串" UserInfo={NSLocalizedDescription=未找到应用程序的“aps-environment”的授权字符串}

解决方案:打开Xcode8,点击下面的地方。


2、去掉无效log并且保留原来的nslog信息

真机下设置OS_ACTIVITY_MODE会让nslog的信息消失,可以把nslog改成printf。

#define LYLog(...) printf("%f %s\n",[[NSDate date]timeIntervalSince1970],[[NSString stringWithFormat:__VA_ARGS__]UTF8String]);

Debug

1、dSYM

当把Objective-C代码编译成汇编、再转译成二进制机器码后,会生成一个dSYM文件包(内含符号表,负责翻译崩溃报告成可读代码)。
.dSYM文件是一个目录,包含一个十六进制的函数地址映射信息的文件,Debug的symbols都在这个文件中(包括文件名、函数名、行号等)。
Xcode项目每次编译后,都会生成一个新的.dSYM文件,故而真机上的崩溃日志需要检查对应的符号表。


2、crash日志分析

WAKEUPS 错误
http://stackoverflow.com/questions/25848441/app-shutdown-with-exc-resource-wakeups-exception-on-ios-8-gm
后台线程有严格的调用限制

Background threads in iOS 8 have a hard limit on how many times you can run a sleep/wake cycle on each thread per second, and having a high count here is usually an indication that something is wrong / inefficient in your thread management.

Xcode

1、Xcode断点失效
  • Clean Project
  • Clean Build Folder
  • Clear Xcode's DerivedData
  • Making sure breakpoints are enabled (Cmd Y)
  • Build Settings are set to Debug
  • Always Show Disassembly enabled and disabled
  • Debugging enabled in run config

最后发现问题出现在Xcode工程,当把老工程的文件全部添加到新工程即可断点。(老工程新建于2013年,猜测是这个原因;可惜没有找到断点失效的真正原因)

2、Xcode并存

在finder中打开应用程序,把xcode改成xcode8,再下载xcode7;

pod相关

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

删除podfile.lock 和 工程,重新pod install

需要注意查看pod install的指令,反馈结果。

集成报错

1、找不到KSYGPUStreamerKit


KSYRTCStreamerKit 继承 KSYGPUStreamerKit,
但是没有引入头文件,使用的是 @class KSYGPUStreamerKit;
于是在使用KSYRTCStreamerKit 必须先导入KSYGPUStreamerKit,
再导入KSYRTCStreamerKit。
给出的demo中,头文件的引用是

#import <libksyrtclivedy/KSYRTCStreamerKit.h>
#import <libksyrtclivedy/KSYRTCStreamer.h>

#import <libksygpuliveDy/libksygpuimage.h>
#import <libksygpuliveDy/KSYGPUStreamerKit.h>

这样第三方在集成的时候,如果按照demo的头文件引入顺序,就会报奇怪的错误。

2、运行时错误

运行时报错:

dyld: Library not loaded:@rpath/GPUImage.framework/GPUImage Referenced
Reason: image not found

原因是运行时没找到GPUImage
解决方案:embedd GPUImage.framework

UIWindow

UIWindow是第一个视图控件(第一个对象是UIapplication),负责展示app内容。
[self.window makekeyandvisible]可以让窗口成为主窗口,并且显示出来。
其他的view依赖于Window,Window显示出来后,view添加在Window上。
UIWindow的三个级别:WindowNormal 、Alert、StatusBar;

UIKIT_EXTERN const UIWindowLevel UIWindowLevelNormal;
UIKIT_EXTERN const UIWindowLevel UIWindowLevelAlert;
UIKIT_EXTERN const UIWindowLevel UIWindowLevelStatusBar __TVOS_PROHIBITED;

UIAlterView的例子:alert级别;


一个普通的视图层级

总结

作为iOS开发,花在iOS的时间不是最多,反省反省反省。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值