草庐IT

iphone - stringFromDate 总是 NIL

我知道这是一个重复的问题,但在stackoverflow和google上搜索了许多类似的问题后,没有一个解决方案适合我。我正在尝试将从数据库接收到的日期转换为字符串格式,以便在iPhone应用程序中显示。我按照以下方式将日期转换为字符串,但是[dateFormatstringFromDate:beginDate]总是返回nil。NSDateFormatter*dateFormat=[[NSDateFormatteralloc]init];[dateFormatsetDateFormat:@"MMMddhh:mma"];NSString*dateString=[dateFormatstr

ios - NSBundle pathForResource : returns nil

我正在尝试使用以下代码从iOS上的Xcode中的支持文件文件夹访问.txt文件:NSString*filePath=@"filename.txt";NSLog(@"Filepath:%@",filePath);NSString*fileRoot=[[NSBundlemainBundle]pathForResource:filePathofType:@"txt"];NSLog(@"Fileroot:%@",fileRoot);第一个NSLog打印出我期望它打印的内容,但最后一个NSLog总是简单地打印Fileroot:(null)在(尝试)将文件读入内存后访问文件中的文本也只会给我一个(

ios - 应用程序试图在目标上推送一个 nil View Controller

我收到以下错误:应用程序试图在目标UINavigationController上推送一个nilViewController:0x7b98940。这是在我“单击”UITableViewController的单元格时引起的。代码:#pragmamark-Tableviewdelegate-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{VerifyInfoViewController*verifyInfoVC=[self.storyboardinstantiateV

objective-c - 自定义 UIControl 始终发送 nil UIEvent 对象

我有一个派生自UIControl的类,我在其中监视touchesBegan/Moved/Ended/Cancelled事件。在这些事件中,我对super响应者和下一个响应者调用相同的事件,如下所示:[self.nextRespondertouchesEnded:toucheswithEvent:event];[selfsendActionsForControlEvents:UIControlEventTouchUpInside];[supertouchesEnded:toucheswithEvent:event];我有一个拥有TableView的父控件。TableView中的每个单元格

IOS OCR tesseract 在为 nil 并使用 ACR 后不释放内存

我花了超过24小时来调试和解决tesseract中的问题,问题是我为多个图像循环下面的函数,每次我跟踪内存,发现每次调用时内存都会增加下划线Tesseract*tesseract=[[Tesseractalloc]initWithLanguage:@"eng+ita"];并且不受下面一行的影响tesseract=nil;下面是调用的完整函数-(void)recognizeImageWithTesseract:(UIImage*)img{UIImage*testb=[imgblackAndWhite];Tesseract*tesseract=[[Tesseractalloc]initWi

ios - object 不能为 nil - 在 segue 上?

我想在我的代码中做的就是从一个View移动到另一个View。无论我尝试使用多少种不同的方法来绕过它,任何segue或当前View的任何更改都会导致此错误:***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'***-[__NSArrayMinsertObject:atIndex:]:objectcannotbenil'根本没有任何迹象表明它在谈论什么对象,而且应用程序在我的segue行上崩溃了。哦,我正在使用Xcode5-DP和iOS7。这是我的来源:LoginViewController

ios - UICollectionView cellForItemAtIndexPath 滚动后返回 nil

我对UICollectionView有疑问。下面的代码是返回获取某个点的单元格(CGPoint)CollectionViewCell*cell=(CollectionViewCell*)[mCollectionViewcellForItemAtIndexPath:[mCollectionViewindexPathForItemAtPoint:point]];if(cell)NSLog(@"Cellexists");elseNSLog(@"Celldoesn'texist");如果UICollectionView保持不动,这将返回一个有效的单元格。如果向下滚动,则返回nil。我不确定是什

ios - ParentViewController 正在变为 nil ,不知道在哪里以及如何

我正在尝试制作一个应用程序,第一步是创建viewControllers并链接它们。我知道我可以使用Storyboard和sueges来做到这一点,但我想用老派的方式来做——通过编码,即它包含4个ViewController-MainViewController-SettingsViewController-RulesViewController这三个ViewController使用ContainerViewController(4thviewController)(我写的自定义容器)进行管理。currentSubViewController跟踪当前显示的viewController@i

ios - 带有 URL 的 NSURLSession downloadTask 返回 nil

我的应用程序中的NSURLSessionDownloadTask有问题我用代码创建了数百个下载任务:NSURLSessionDownloadTask*task=[_urlSessiondownloadTaskWithURL:downloadUrl];NSLog(@"session:%@,downloadtask%@forurl:'%@'",_urlSession,task,downloadUrl);if(!task){NSLog(@"ooopsnotask");}else{}在xcode控制台中,我有这样的消息:2014-03-2811:23:39.297MYAPP[3838:60b]

ios - 在自定义转换中获取 nil [transitionContext containerView]

我正在尝试在两个uiviewcontroller之间的转换期间创建自定义动画。当我试图弹出一个ViewController时,我在[transitionContextcontainerView]中得到了nil对象。这是我的自定义转换类代码-(void)animateTransition:(id)transitionContext{UIViewController*toViewController=(UIViewController*)[transitionContextviewControllerForKey:UITransitionContextToViewControllerKey