AAAA block
[self AAAA:^(BOOL isSuccessed, id userInfo, NSString *errorMsg) {
NSLog(@"AAAA: %d, userInfo: %@ errorMsg: %@", isSuccessed, userInfo, errorMsg);
}];
-(void)AAAA:(void(^)(BOOL isSuccessed,id userInfo,NSString *errorMsg))callback
{
__block NSMutableDictionary *_info = [@{} mutableCopy];
[self a001:
^(BOOL isSuccessed, id userInfo, NSString *errorMsg) {
NSLog(@"a001");
if (isSuccessed) {
[_info setObject:userInfo forKey:@"001info"];
}
else
{
[_info setObject:errorMsg forKey:@"001info"];
}
[self a002:^(BOOL isSuccessed, id userInfo, NSString *errorMsg) {
NSLog(@"a002");
if (isSuccessed) {
[_info setObject:userInfo forKey:@"002info"];
}
else
{
[_info setObject:errorMsg forKey:@"002info"];
}
[self a003:^(BOOL isSuccessed, id userInfo, NSString *errorMsg) {
NSLog(@"a003");
if (isSuccessed) {
[_info setObject:userInfo forKey:@"003info"];
}
else
{
[_info setObject:errorMsg forKey:@"003info"];
}
if (callback) {
callback(YES,@"userInfo", @"errorMsg");
}
}];
}];
}];
}
-(void)a001:(void(^)(BOOL isSuccessed,id userInfo,NSString *errorMsg))callback
{
NSLog(@"a001 inner");
if (callback) {
callback(YES,@"userInfo", @"errorMsg");
}
}
-(void)a002:(void(^)(BOOL isSuccessed,id userInfo,NSString *errorMsg))callback
{
NSLog(@"a002 inner");
if (callback) {
callback(YES,@"userInfo", @"errorMsg");
}
}
-(void)a003:(void(^)(BOOL isSuccessed,id userInfo,NSString *errorMsg))callback
{
NSLog(@"a003 inner");
if (callback) {
callback(NO,@"userInfo", @"errorMsg");
}
}
AAAA block的更多相关文章
- I.MX6 Linux udev porting
/*********************************************************************** * I.MX6 Linux udev porting ...
- iOS block
主要内容: block基本声明格式 block访问区域变量 block代替代理 block基本声明格式: ^(传入的参数){具体代码}; 注: Block实体开头是"^",接着是由 ...
- 小程序block标签配合if和else 和 动态修改标题栏
<block wx:if="{{aaaa}}"> <view>aaaa为 true,显示</view> </block> <b ...
- iOS 技术篇:从使用到了解block底层原理 (一)
1.概述 block : Object - C对于闭包的实现 . 闭包 = 一个函数(或是指向函数的指针) +该函数执行的外部的上下文变量(自由变量) 2.对block的理解 可以嵌套定义,定义 bl ...
- Objective-C中block的底层原理
先出2个考题: 1. 上面打印的是几,captureNum2 出去作用域后是否被销毁?为什么? 同样类型的题目: 问:打印的数字为多少? 有人会回答:mutArray是captureObject方法的 ...
- iOS 键盘添加完成按钮,delegate和block回调
这个是一个比较初级一点的文章,新人可以看看.当然实现这个需求的时候自己也有一点收获,记下来吧. 前两天产品要求在工程的所有数字键盘弹出时,上面带一个小帽子,上面安装一个“完成”按钮,这个完成按钮也没有 ...
- python中IndentationError: expected an indented block错误的解决方法
IndentationError: expected an indented block 翻译为IndentationError:预期的缩进块 解决方法:有冒号的下一行要缩进,该缩进就缩进
- JDBC Tutorials: Commit or Rollback transaction in finally block
http://skeletoncoder.blogspot.com/2006/10/jdbc-tutorials-commit-or-rollback.html JDBC Tutorials: Com ...
- 嵌入式&iOS:回调函数(C)与block(OC)传 参/函数 对比
C的回调函数: callBack.h 1).声明一个doSomeThingCount函数,参数为一个(无返回值,1个int参数的)函数. void DSTCount(void(*CallBack)(i ...
随机推荐
- 【成端更新线段树模板】POJ3468-A Simple Problem with Integers
http://poj.org/problem?id=3468 _(:зゝ∠)_我又活着回来啦,前段时间太忙了写的题没时间扔上来,以后再说. [问题描述] 成段加某一个值,然后询问区间和. [思路] 讲 ...
- 随机数选择器 Exercise07_13
import java.util.Scanner; /** * @author 冰樱梦 *时间:2018年下半年 *题目:随机数选择器 */ public class Exercise07_13 { ...
- Codeforces Beta Round #1 C. Ancient Berland Circus 计算几何
C. Ancient Berland Circus 题目连接: http://www.codeforces.com/contest/1/problem/C Description Nowadays a ...
- CentOS6安装NodeJS(非编译)
由于编译安装需要各种依赖库,会远远高于生产环境下的默认版本,强行升级会产生很多不必要的问题,所以一般用官网编译好的安装 下载nodejs并安装 wget https://nodejs.org/dist ...
- 微软笔试Highway问题解析
High way 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 In the city, there is a one-way straight highway ...
- mysql语句总结
mysql语句总结 -- 1,通过windows提供的服务管理来完成 -- services.msc -- 2,dos下的命令来完成 -- 停止 -- net stop mysql -- 启动 -- ...
- [Linux] ubuntu 软件安装必须看的网址
http://wiki.ubuntu.org.cn/index.php?title=Qref/Apps&variant=zh-hans 这里介绍了unbuntu常用软件及其安装,免得你百度来百 ...
- [转]Oracle connection strings
本文转自:http://www.connectionstrings.com/oracle/ Standard Data Source=MyOracleDB;Integrated Security=ye ...
- c/c++的|、||、&、&&、异或、~、!运算
位运算 位运算的运算分量只能是整型或字符型数据,位运算把运算对象看作是由二进位组成的位串信息,按位完成指定的运算,得到位串信息的结果. 位运算符有: &(按位与).|(按位或) ...
- TestNG 一、 概论
一. 概论 TestNG,即Testing, NextGeneration,下一代测试技术,是一套根据JUnit 和NUnit思想而构建的利用注释来强化测试功能的一个测试框架,即可以用 ...