Archive

Posts Tagged ‘iOS’

Xcode8 beta版无法输出NSLog问题

August 4th, 2016 No comments

使用Xcode8的Beta版本进行Objective-C/iOS程序调试时,使用NSLog无法输出日志,同时输出以下内容:
subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0

subsystem: com.apple.FrontBoard, category: Common, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0

同样的Objective-C/iOS代码在Xcode7版本输出正常,没有出现。

苹果的官方论坛也有人提了Xcode8 beta的Bug
https://forums.developer.apple.com/thread/49136
Read more…

[iOS]objective-c AES/DES/3DES等加密算法实现

January 12th, 2016 No comments

objective-c对AES/DES/3DES等加密提供了统一的加密方法CCCrypt进行实现,目前主要支持的算法有

@constant kCCAlgorithmAES128 Advanced Encryption Standard
@constant kCCAlgorithmAES Advanced Encryption Standard, 128-bit block
@constant kCCAlgorithmDES Data Encryption Standard
@constant kCCAlgorithm3DES Triple-DES, three key, EDE configuration
@constant kCCAlgorithmCAST CAST
@constant kCCAlgorithmRC4 RC4 stream cipher
@constant kCCAlgorithmBlowfish Blowfish block cipher

Read more…

Categories: 零敲碎打 Tags: , ,

[iOS] 实现IIF功能和DECODE函数功能

January 12th, 2016 No comments

iOS开发过程中需要处理大量分支判断代码,需要大量使用if、switch等进行分支处理。代码编写和查看都可能出现潜在问题,使用Objective-c语言的自身特点,可以通过以下转换,优化分支判断处理的代码写法。关键是可以一行代码搞定各种分支判断。实现代码简化。

使用宏定义将三目运算改为IIF函数运算,类似于EXCEL的IF公式

#if !defined(IIF)
#define IIF_IMPL(condition,true_,false_) (condition)?true_:false_
#define IIF(condition,true_,false_) IIF_IMPL(condition,true_,false_)
#endif

Read more…

[iOS]Xcode7.0关闭Bitcode编译

December 8th, 2015 No comments

今天在iOS上编译原来开发的代码,出现了以下错误

xxxx.o does not contain bitcode. You must rebuild it with bitcode enabled (Xcodesetting ENABLE_BITCODE)

百度后知道Xcode7.0以后会默认开启Bitcode模式,很多旧的静态库由于编译问题,无法支持Bitcode,需要重新编译才能使用。

如果不想重新编译,只需要关闭Bitcode就可以了

具体按以下操作:
在Targets -> Build Settings -> Build Options 下
将Enable Bitcode 设置为NO即可
Read more…

Categories: 零敲碎打 Tags: ,

MAC OS编译iOS版Linphone SDK和APP

October 28th, 2015 No comments

最近由于开发一款基于SIP通信的VOIP应用程序项目需要,自己研究了一下几款开源SIP实现,主要有PJSIP和Linphone,PJSIP由于文档说明详细,编译和测试都没有费多大事情。Linphone的编译就比较费神费力了,开始之前查看互联网上的资料,大家都说各种痛苦折磨,后来自己实践了一把,除了文档说明奇缺之外,编译还算顺利,除了调查耗费了不少时间。

Read more…

Categories: 移动互联, 语言编程 Tags:

[Xcode]XcodeGhost问题的检查和验证

September 24th, 2015 No comments

这两天XcodeGhost问题搞得国内所有iOS开发者人心惶惶,如果你在编译和上线APP时,使用的是非官方下载的Xcode话,编译出来的app会被注入一段恶意代码,恶意代码会向特定服务器(init.icloud-analysis.com)上传机器相关数据,更严重的是变种的恶意代码还会劫持APP中所有的弹出对话框。

给出一个简单的检查方法:
1.进入以下目录
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
2.目录下包含以下内容,恭喜中招。正常的Xcode没有的
Library/Frameworks/CoreServices.framework/CoreService
Read more…

Categories: 零敲碎打 Tags: , ,

[iOS] iOS9.0 关闭系统强制使用HTTPS

August 25th, 2015 1 comment

iOS9.0以后出于对请求安全的考虑默认将Foundation.framework中的HTTP请求协议更换为SSL/TLS,也就是说所有由程序发起的HTTP请求默认将请求HTTPS的内容,而且在HTTPS出现404时不会请求HTTP的内容,如果你的APP原来就使用HTTPS,基本问题不大,但是如果使用HTTP的话,就需要:
1.修改你的服务器配置,使它支持HTTPS访问
2.修改你的info.plist配置,让APP能访问普通的HTTP协议网站
否则调试程序时会在Log中出现以下提示:

App Transport Security has blocked a cleartext HTTP (http://) resource
 load since it is insecure. Temporary exceptions can be configured via
 your app's Info.plist file.

Read more…

Categories: 移动互联, 零敲碎打 Tags: , ,