1) google questions and answers
2014-07-27 14:40
316 查看
1. 如何同时iOS dictionary的key和value
http://stackoverflow.com/questions/1284429/is-there-a-way-to-iterate-over-a-dictionaryNSEnumerator *enumerator = [myDict keyEnumerator]; id key; // extra parens to suppress warning about using = instead of == while((key = [enumerator nextObject])) NSLog(@"key=%@ value=%@", key, [myDict objectForKey:key]);
2. 为什么调用NSMutableArray length会crash
获取array中元素的个数请用count而不是length。http://stackoverflow.com/questions/19856143/nsstring-under-arc-may-cause-nsarraym-length-unrecognized-selector-sent-to
3. 在block中赋值出现错误 variable is not assignable (missing __block type specifier)
http://stackoverflow.com/questions/7962721/how-to-assign-a-variable-inside-a-block-to-a-variable-outside-a-blockhttps://developer.apple.com/library/ios/documentation/cocoa/conceptual/Blocks/Articles/bxVariables.html
block本身默认不会改变global的外部变量,并且是使用的第一次当block定义的时候的变量,如果要改变请在变量定义之前加上__block
int anInteger = 42; |
// __block int anInteger = 42; //只有这样菜可以在block中改变数值 |
void (^testBlock)(void) = ^{ // 在第一次定义的时候已经将42作为一个const的数读进来 |
NSLog(@"Integer is: %i", anInteger); |
}; |
anInteger = 84; // 不会改变block中的数值了 |
testBlock(); |
4. clang: error: linker command failed with exit code 1 (use -v to see invocation)
a按照提示把-v作为link的option加进去,然后重新编译,就会得到更详细的错误说明,原来是一个global的变量的在两个不同的文件中都有定义.相关文章推荐
- google questions and answers
- google questions and answers
- poj 2371 Questions and answers
- C/C++ Programming interview questions and answers
- URAL 1026. Questions and answers
- POJ 一 2371 Questions and answers
- .NET Interview Questions And Answers
- Pku acm 2371 Questions and answers 排序算法解题报告(三)----二叉查找数(BST)排序
- (使用STL自带的排序函数7.3.4)POJ 2371 Questions and answers(sort()函数的使用)
- Top 10 Java Serialization Interview Questions and Answers
- Some Essential JavaScript Questions And Answers(2)
- .NET Interview Questions And Answers
- Java Multi-Threading and Concurrency Interview Questions with Answers
- 10 Hibernate Interview Questions and Answers for Java J2EE Programmers
- .NET Interview Questions And Answers
- Servlet JSP Tutorial -- 1.15 50 Servlet Interview Questions and Answers
- Top 25 Most Frequently Asked Interview Core Java Interview Questions And Answers
- iOS interview questions and Answers
- Some Essential JavaScript Questions And Answers(6)
- poj 2371 Questions and answers