为AppDelegate分层的面向服务架构的 SOAComponentAppDelegate (AppDelegate 回调分层)
来源:互联网 发布:ipad好用软件 编辑:程序博客网 时间:2024/06/13 20:17
http://blog.csdn.net/teamlet/article/details/50864893
名称解释一下:
1、SOA是面向服务的架构,所有的第三方功能都被分别封装成服务。
2、Component 表示这个类是用于引用的,不能用于继承。
是对上一篇《使用category 为 AppDelegate 的代码分层》的改进,原文地址 http://blog.csdn.NET/teamlet/article/details/50863761 。
一、首先创建服务类,服务类是对第三方服务的封装。第三方服务包括推送、支付、统计等
1、服务举例 BaiduPushService 头文件
新创建的服务类需要添加 <UIApplicationDelegate> 协议,根据需要实现协议中的方法。这里只添加了一个作为演示。
2、实现类
二、组件类
1、 SOAComponentAppDelegate.h 头文件
定义单例方法instance()和获取服务的方法services。
2、SOAComponentAppDelegate.m实现
在实现类中,需要引用并注册第三方的服务类。
三、使用
1、AppDelegate.h 不做任何改动。
2、AppDelegate.m
导入 SOAComponentAppDelegate 和 BaiduPushService
在对应的方法里调用第三方服务中已经封装好的方法。
这样就可以完全独立的处理每个不同的第三方服务。
0 0
- 为AppDelegate分层的面向服务架构的 SOAComponentAppDelegate (AppDelegate 回调分层)
- 为AppDelegate分层的面向服务架构的 SOAComponentAppDelegate
- 使用category 为 AppDelegate 的代码分层
- 使用category 为 AppDelegate 的代码分层
- 一个电商项目的Web服务化改造5:面向服务的分层架构设计(有图有真相)
- AppDelegate的科幻用法
- AppDelegate的使用
- AppDelegate的详解
- AppDelegate的科幻用法
- AppDelegate的科幻用法
- IOS的AppDelegate 事件
- AppDelegate的详解
- AppDelegate的运用
- AppDelegate的详解
- AppDelegate的详解
- iOS AppDelegate的详解
- appDelegate的详解
- appDelegate的几个方法
- 如果你的错误是 javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-c
- iOS 关于tableView cell的分割线的一些设置
- js 和 安卓互相调用
- 如何介绍你的项目
- 快速排序
- 为AppDelegate分层的面向服务架构的 SOAComponentAppDelegate (AppDelegate 回调分层)
- 小米手机退出app后收不到极光推送消息
- 排序字段不要用varchar类型
- 跟据某天日期获取农历或者节假日信息
- Java流编程实例之九--加密流
- logback异步输出日志
- 软键盘遮挡登录按钮的处理方法
- ImageView.ScaleType / android:scaleType
- swift cell报错