iOS 程序在UITextView中显示NSLog日志的方法,

 最近开发程序,需要做个给测试人员的demo,客户端可以实时 显示程序的打印日志的功能,

查找了很多的资料找到个方法,利用NSPipe即可以实现,

苹果官方解释:

      objects provide an object-oriented interface for accessing pipes. An NSPipe object represents both ends of a pipe and enables communication through the pipe. A pipe is a one-way communications channel between related processes; one process writes data, while the other process reads that data. The data that passes through the pipe is buffered; the size of the buffer is determined by the underlying operating system.NSPipe is an abstract class, the public interface of a class cluster.

   NSPipe是一个抽象类,一类集群的公共接口。通过NSPipe 我们可以方便的读取和写入进程数据,

如果想实现将 程序的实时日志打印,可以在控制器中添加下边方法

- (void)redirectNotificationHandle:(NSNotif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值