我的应用程序运行并在10.7上测试但后来意识到我需要它才能在早期版本上运行.不幸的是,我从一开始就用ARC开始了这个项目.
现在我的构建设置是debug base sdk:10.7,release base sdk:10.6.当我尝试存档我的应用程序时,我收到以下错误:
Undefined symbols for architecture x86_64:
"_objc_retain", referenced from:
+[__ARCLite__ load] in libarclite_macosx.a(arclite.o)
-[AppDelegate applicationDidFinishLaunching:] in AppDelegate.o
-[AppDelegate managedObjectModel] in AppDelegate.o
-[AppDelegate persistentStoreCoordinator] in AppDelegate.o
-[AppDelegate managedObjectContext] in AppDelegate.o
-[AppDelegate windowWillReturnUndoManager:] in AppDelegate.o
-[AppDelegate saveAction:] in AppDelegate.o
...
(maybe you meant: _objc_retainedObject)
"_objc_release", referenced from:
-[AppDelegate applicationDidFinishLaunching:] in AppDelegate.o
-[AppDelegate applicationFilesDirectory] in AppDelegate.o
-[AppDelegate managedObjectModel] in AppDelegate.o
-[AppDelegate persistentStoreCoordinator] in AppDelegate.o
-[AppDelegate managedObjectContext] in AppDelegate.o
-[AppDelegate windowWillReturnUndoManager:] in AppDelegate.o
-[AppDelegate saveAction:] in AppDelegate.o
...
"_objc_retainAutoreleasedReturnValue", …
Run Code Online (Sandbox Code Playgroud) 我今天遇到了这个非常令人沮丧的问题.
我想将我的观点设置为像这样自动调整:
http://f.cl.ly/items/0Q393e1R031n3w103p3R/Image%202012.05.25%203:05:06%20PM.png
但是我在NSView的xcode设置中找到的所有内容都是这样的:
http://f.cl.ly/items/0Q2d3z2I0K1x3p1n1w0h/Image%202012.05.25%203:07:01%20PM.png
这两个截图来自两个不同的项目,使用相同的xcode 4.3.2.这是一个错误还是我错过了什么?
谢谢.
我正在开发一个与Rest Web服务交流的应用程序.我使用的JSon解析器是SBJson.服务器端的这个Web服务返回一个beanA.这个bean包含一个beanB.当有多个bean时,我从服务器端得到的Json的一部分是这样的:
BeanB =
(
{
key = 12;
name = test2bbb;
},
{
key = 11;
name = test2ttt;
}
);
Run Code Online (Sandbox Code Playgroud)
当只有一个bean时,它看起来像这样:
BeanB =
{
key = 10;
name = test3;
};
Run Code Online (Sandbox Code Playgroud)
通过SBJson解析器,当只有一个BeanB返回时,我得到了一个字典,并在返回多个BeanB时获得了一个数组.我用来接收bean的代码是:
NSArray/NSDictionary *BeanB = [BeanADic objectForKey:@"beanB"];
Run Code Online (Sandbox Code Playgroud)
问题是我无法预测我将从服务器端获得什么.有没有办法测试返回类型?
我尝试使用NSFileManager的attributesOfItemAtPath.它适用于文件,但不适用于文件夹.虽然在Apple的文档中,他们声称它应该在文件或文件夹上工作.但是如果我在文件夹上调用它,我得到的只是零值.
我使用的代码:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDictionary *folderAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:somePath error:nil];
NSLog(@"Creation date: %@", [dateFormatter stringFromDate:[folderAttributes objectForKey:NSFileCreationDate]]);
Run Code Online (Sandbox Code Playgroud)
输出对我来说总是空的.我的"somePath"是一个NSString,格式如下:
file://localhost/Users/username/...
Run Code Online (Sandbox Code Playgroud)
思考?谢谢!