Tag: cocoa

无法将Google Analytics(分析)3.01与XCode 5(缺less必需的体系结构x86_64)

我已经构build了我的应用程序(针对iOS7),现在希望将Google Analytics(分析)作为提交之前的最后一步。 我做了什么: 下载的iOS 3.01的GA 将/GoogleAnalytics/Library/ 内容导入 /GoogleAnalytics/Library/组 将libGoogleAnalyticsServices.a导入“ libGoogleAnalyticsServices.a ”组 使用libGoogleAnalyticsServices.a添加构build阶段并交换构build阶段libGoogleAnalyticsServices.a 在我的-Prefix.pch文件中添加了代码块#include "GAI.h" 。 初始化我的AppDelegate的[GAI sharedInstance] 。 我附上了这篇文章底部的设置截图。 当我尝试构build(无论是设备或模拟器,都是32位),我得到以下链接器错误: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GAI", referenced from: objc-class-ref in FTVAppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 我如何解决这个问题? 更新1 我也得到警告 […]

Xcode链接器错误:文件太小,体系结构x86_64

我正在Xcode中开发一个应用程序。 当我尝试构build时,出现这个错误: ld: in /Users/theodore/Library/Developer/Xcode/DerivedData/Tower-bkpdifuqssebjdgurzmtirbxejnn/Build/Intermediates/Tower.build/Debug/Tower.build/Objects-normal/x86_64/TWRAppDelegate.o, file too small for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 有谁知道什么是错的?

所有用户和组的列表

我正在尝试获取Mac OS X 10.5以上版本的所有用户和所有组。 我怎样才能做到这一点? 例如,我的机器上所有用户的列表应该返回: _amavisd, _appowner, _appserver, _ard, _atsserver, _calendar, _carddav, _clamav, _coreaudiod, _cvmsroot, _cvs, _cyrus, _devdocs, _dovecot, _eppc, _installer, _jabber, _lda, _locationd, _lp, _mailman, _mcxalr, _mdnsresponder, _mysql, _pcastagent, _pcastserver, _postfix, _qtss, _sandbox, _screensaver, _securityagent, _serialnumberd, _softwareupdate, _spotlight, _sshd, _svn, _teamsserver, _timezone, _tokend, _trustevaluationagent, _unknown, _update_sharing, _usbmuxd, _uucp, _windowserver, _www, _xgridagent, _xgridcontroller, daemon, […]

关于“潜在空解除引用”的Clang错误

我不断得到Clang错误的代码,我不明白为什么他们是错误的,或者如何解决他们克朗的满意度: + (NSString *)checkForLength: (NSString *)theString error: (NSError **)error { BOOL hasLength = ([theString length] > 0); if (hasLength) return theString; else { *error = [NSError errorWithDomain:@"ErrorDomain" code:hasLength userInfo:nil]; return nil; } } 撇开这个例子的完全devise的本质(Clang所反对的,所以这个例子足够说明问题),Clang在错误分配线上抱怨以下的反对意见: 潜在的空解除。 根据“创build和返回NSError对象”中的编码标准,参数“错误”可能为空。 我喜欢有一个原始的Clang报告。 我已阅读引用的文件,我不能看到一个方法去做预期的事情; 我查了一些开源的Cocoa库,这似乎是一个常见的习惯用法。 有任何想法吗?

用stream畅的animation显示/隐藏导航栏

我有一个基于导航的应用程序。 第一个视图(rootcontroller)只有三个大button。 没有导航栏。 从那里,一切都是桌面和导航栏。 我正在做这个来显示/隐藏导航栏: MyAppAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; appDelegate.navigationController.navigationBar.hidden = NO; 一旦我离开根控制器,导航栏就会跳到位置,并放在桌面视图的顶部,而不是推下来。 它剪辑桌面的顶部。 回到根控制器在导航栏如何消失不平滑。 是否有一个更顺利/更好的方法来完成只隐藏根控制器的导航栏?

Obj-C中的多值枚举

在Cocoa和Cocoa Touch框架中,枚举被用作常量。 我了解如何使用它,除了在一种情况下,您可以通过|作为parameter passing多个值的情况 运营商。 像 : pageControl.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin); 枚举声明如下: enum { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizingFlexibleRightMargin = 1 << 2, UIViewAutoresizingFlexibleTopMargin = 1 << 3, UIViewAutoresizingFlexibleHeight = 1 << 4, UIViewAutoresizingFlexibleBottomMargin = 1 << 5 }; typedef NSUInteger UIViewAutoresizing; 我怎样才能定义自己这种types的枚举(即什么<<意味着什么),如何检查作为parameter passing的倍数值?

如何绘制UIImage或直接在-drawRect中:?

我有一个UIImage ,我想在UIView上绘制。 但是,而不是创build一个UIImageView并将其添加为子视图,我想覆盖-drawRect:并直接绘制我的UIView。 例如,我的代码如下所示: – (void)drawRect:(CGRect)rect { CGContextRef myContext = UIGraphicsGetCurrentContext(); UIImage *img = [UIImage imageNamed:@"foo.png"]; // how to draw the directly into the view now? }

在cocoa你喜欢NSInteger或int,为什么?

NSInteger / NSUInteger是Cocoa定义的常规内置types的替代品。 使用内置的NS *types有什么好处? 你更偏向于哪个,为什么? NSInteger和int在32位/ 64位平台上的宽度是否相同?

如何在NSNotification中传递userInfo?

我想使用NSNotification发送一些数据,但卡住了。 这是我的代码: // Posting Notification NSDictionary *orientationData; if(iFromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { orientationData = [NSDictionary dictionaryWithObject:@"Right" forKey:@"Orientation"]; } NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter postNotificationName:@"Abhinav" object:nil userInfo:orientationData]; // Adding observer [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged) name:@"Abhinav" object:nil]; 现在如何在我的select器orientationChanged中获取这个userInfo字典?

用于创buildNSTextField“标签”的示例代码?

在我的桌面Mac OS X应用程序中,我想以编程方式创build一个NSTextField“标签”,它具有与在Interface Builder中创build的典型标签相同的行为和属性。 我通常使用(和非常像)IB,但在这种情况下,它必须以编程方式完成。 尝试我可能,我似乎无法find方法调用的组合,将编程方式产生相同的label-y行为作为从IB视图库调色板拖动“标签”。 任何人都可以提供或指出一些示例代码如何以编程方式做到这一点? 谢谢。