Tag: exc

iOS:lldb EXC_BAD_ACCESS自定义单元格

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"LibraryListingCell"; InSeasonCell *cell = (InSeasonCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"InSeasonCellView" owner:self options:nil]; cell = [_cell autorelease]; _cell = nil; } if(_dataController!=NULL){ Product *productAtIndex = [_dataController objectInListAtIndex:indexPath.row]; // Configure the cell… if (productAtIndex.name != nil && productAtIndex.week != nil && […]

UIAlertview exc_bad_access

我添加了一个函数来closuresUIAlertView几秒钟后。整个代码是这样的: – (void)netWorkAlert { UIAlertView *netWork = [[UIAlertView alloc] initWithTitle:@"error" message:@"network has problems" delegate:self cancelButtonTitle:nil otherButtonTitles: nil]; [netWork show]; [self performSelector:@selector(dismissAlert:) withObject:netWork afterDelay:2]; } – (void)dismissAlert:(UIAlertView *)alert { if(alert) { [alert dismissWithClickedButtonIndex:0 animated:YES]; [alert release]; } } networking不可用时调用netWorkAlert 。 现在我遇到的问题是当第二次调用netWorkAlert时,应用程序被破坏,Xcode显示错误 int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([ZJAppDelegate class])); //Thread […]

EXC_BAD_ACCESS在touchesBegan之后

我已经开始了一个学习iOS编程的非常简单的项目,但是在touchesBegan之后我得到了EXC_BAD_ACCESS 。 您可以在这里从DropBox下载项目。 我基本上有一个UIView子类,应该在用户触摸的地方绘制圆圈。 很简单,但我不能让它工作。 任何帮助,高度赞赏。 谢谢! 编辑原来这个问题是在touchesBegan这行代码: ts = [NSMutableSet setWithSet: [event touchesForView:self]]; 我改成: ts = [[NSMutableSet setWithSet: [event touchesForView:self]] retain];

我应该怎么做才能调用audioPlayerDidFinishPlaying:

我写这个源程序。 但是我不能调用audioPlayerDidFinishPlaying:方法。 播放声音后,几秒钟后由“exc_bad_access”错误崩溃。 .h文件 #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface SecondViewController : UIViewController< AVAudioPlayerDelegate>{ AVAudioPlayer *aPlayer; } @end .m文件 -(void)playSound{ NSString *soundName = @"red"; NSError *error = nil; NSURL *soundUrl = [[NSBundle mainBundle] URLForResource:soundName withExtension:@"mp3"]; aPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:&error]; if (error != nil) { NSLog(@"audio_player initialized error :(%@)",[error localizedDescription]); [aPlayer release]; error=nil; return; } […]

如何从相机胶卷获取照片?

我试图使用ALAssetLibrary来获取专辑和照片。 这是我的代码: void(^ assetEnumerator)(struct ALAsset *,NSUInteger,BOOL *)= ^(ALAsset * result,NSUInteger index,BOOL * stop){ if(result!= NULL){ NSLog(@“See Asset:%@”,result); } }; void(^ assetGroupEnumerator)(struct ALAssetsGroup *,BOOL *)= ^(ALAssetsGroup * group,BOOL * stop){ if(group!= nil){ [group enumerateAssetsUsingBlock:assetEnumerator]; } }; ALAssetsLibrary * library = [[ALAssetsLibrary alloc] init]; [库enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:assetGroupEnumerator failureBlock:^(NSError * error){ 的NSLog(@ “失败”); }]; 我得到exc_bad_access:[组enumarateAssetsUsingBlock:assetEnumerator]和组不是零。 奇怪的是,这个代码工作,如果我创build一个新的项目,但在我的旧项目,它不工作。 SDK版本是iOS 4.3 在iPhoneSimulator […]

带SWRevealViewController的Exc_bad_指令

背景我的应用程序有一个MainViewController与UIButton导致另一个ViewController按下时。 在第二个ViewController是一个UIBarButtonItem它有一个“后退”inheritance到MainViewController。 一切都工作得很好,直到现在当我编程一个滑出菜单的SWRevealViewController的帮助下,我遵循这个Jared Davidson教程https://www.youtube.com/watch?v=8EFfPT3UeWs (简单,一般和简单) 问题滑出菜单完美地工作,但现在当按下第二个ViewController中的“返回”button崩溃的应用程序,由于 EXC_BAD_INSTRUCTION(code = EXC_I1386_INVOP,subcode = 0x0) 从MainViewController文件中的以下代码中,查看关于滑出菜单的平移手势。 码 这是我的MainViewControllers关于我的滑出菜单的代码。 它完美的工作,但它与第二个ViewController简单的“后退”segue推断。 @IBOutlet weak var Open: UIBarButtonItem! override func viewDidLoad() { super.viewDidLoad() Open.target = self.revealViewController() Open.action = Selector("revealToggle:") self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer()) //THIS IS THE CODE WHERE THE ERROR ALEERT OCCURS } 当最后一行代码被删除时,“返回”再次继续,但显然不是滑出菜单。 帮助是否可以指定平移手势代码只有MainViewController及其滑出菜单,让“后退”segue只显示MainViewController像以前和/或“忽略”这行代码。 或者是否有可能以其他方式分开这两个,并避免从第二个ViewController(回到MainViewController)的“返回”segue按下时我的应用程序崩溃? 在此先感谢传说。

ios通知“死”的对象

我有一些UIViews进入视图,然后走出看法和未使用。 不过,我相信其中一些人在收到通知后,即使在他们离开后也会造成问题。 在UIView“父”容器上: if(self._content != nil && [self._content respondsToSelector:@selector(presentMe:)]) { [self._content presentMe:NO]; } 在UIView“孩子”: [[NSNotificationCenter defaultCenter] <– EXC_BAD_ACCESS (code=1, address=0x70000008 postNotificationName:PRESENTING object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:prepareToEnter], PRESENTING, nil]]; 一切工作都是第一次,但如果我第二次启动相同的视图,我会得到一个EXC_BAD_ACCESS。 这不是说有什么缺失吗? 仅供参考,这是所有在ARC – Xcode 4.3.2

上的访问错误

我在我的UICollectionView中遇到了一个奇怪的崩溃。 崩溃的UICollectionViewembedded在另一个UICollectionView的UICollectionView单元格中。 我不能重现这个问题,它似乎有时如果内部UICollectionView得到新的初始化,因为外面的CollectionView正在重新加载它的单元格。 com.apple.main-thread崩溃 0 libobjc.A.dylib objc_msgSend + 9 1 UIKit – [UICollectionViewData _setLayoutAttributes:atGlobalItemIndex:] + 60 2 UIKit __45- [UICollectionViewData validateLayoutInRect:] _ block_invoke_0 + 668 3 UIKit – [UICollectionViewData validateLayoutInRect:] + 1408 4 UIKit – [UICollectionViewData layoutAttributesForElementsInRect:] + 82 5 UIKit – [UICollectionView setCollectionViewLayout:animated:] + 1644 6 MyApp BSCTopnewsCollectionView.m第52行 – [BSCTopnewsCollectionView setupBSCTopnewsCollectionView] 7 MyApp BSCTopnewsCollectionView.m第27行 […]

actionForLayer中的崩溃:forKey:

当改变一些UILabel的框架时,我有一个神秘的EXC_BAD_ACCESS。 碰撞是随机的,通常我必须重复几分钟的条件。 启用NSZombies,以及其他内存debugging标志(NSDebugEnabled,MallocStackLogging),没有帮助,崩溃仍然保持不透明:只是一个BAD_ACCESS没有消息在控制台。 目标似乎是正确的和活着的,所以它看起来不像一个解除分配的内存问题。 为了获得更多信息,我分类了UILabel并重写了崩溃函数: @implementation TestUILabel – (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event { return [super actionForLayer:layer forKey:event]; } @end 它在超级的方法崩溃,但在检查一切似乎是正确的(打印retainCount“自我”和“层”分别给出3和2): (gdb)po自我 <TestUILabel:0x6ac2800; baseClass = UILabel; 帧=(173 174; 0 0); 文字= '54平方米'; opaque = NO; autoresize = LM + TM; autoresizesSubviews = NO; userInteractionEnabled = NO; animation= {position = <CABasicAnimation:0xe07ba60>; }; 层= <CALayer:0xbf1b950 >> (gdb)po事件 界限 […]

Swift中的parser.parse()会导致EXC_BAD_ACCESS

我正在关注这个教程,作为我在Swift中工作的RSS提要应用程序的一个开始。 自从本教程以来,我知道在Swift中有些事情已经发生了变化,但是他们都没有解释为什么我会遇到这个问题。 相关代码(据我所知)如下在我的TableViewController: override func viewDidLoad() { super.viewDidLoad() let url:NSURL = NSURL(string: "my.url.string") parser = NSXMLParser(contentsOfURL: url) parser.delegate = self parser.parse() // <- Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) } 实际的parsing器委托方法似乎没有问题,因为我在这些方法上放置了断点,在崩溃之前甚至没有被调用。 我的假设是,这是一个Swift错误,但我想确保我没有错过任何东西,然后我去抱怨苹果。