我遇到的那些坑

今天公司要求引导页要放视频动画 播放一个十秒的视频 使用AVAudioPlayer 框架播放

代码编写完成后 直接崩溃 半天找不到原因 全局断点也开着 但是一运行就是这个样的 很迷糊

我遇到的那些坑_第1张图片
Snip20170111_1.png

libc++abi.dylib`__cxa_throw: 异常?

后台调试了半天 终于找到原因 原因就出来断点上了 将断点处设置修改


我遇到的那些坑_第2张图片
屏幕快照 2017-01-11 下午2.34.02.png

将all 改为 object-c 就好啦 !!!

- (UIViewController *)viewController { for (UIView* next = [self superview]; next; next = next.superview) { UIResponder *nextResponder = [next nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)nextResponder; } } return nil; }

-(UIViewController *)currentViewController {
UIViewController * currVC = nil;
UIViewController * Rootvc =``self.window.rootViewController ;
do { if ([Rootvc isKindOfClass:[UINavigationController class]]) {
UINavigationController * nav = (UINavigationController *)Rootvc; UIViewController * v = [nav.viewControllers lastObject];
currVC = v; Rootvc = v.presentedViewController; continue;
}else if([Rootvc isKindOfClass:[UITabBarController class]]){
UITabBarController * tabVC = (UITabBarController *)Rootvc;
currVC = tabVC; Rootvc = [tabVC.viewControllers objectAtIndex:tabVC.selectedIndex];
continue; }else if ([Rootvc isKindOfClass:[XXXCustom class]]){
XXXCustom * tabVC = (XXXCustom *)Rootvc;
currVC = tabVC;
Rootvc = tabVC.selectedViewController; continue;
} } while (Rootvc!=nil);
return currVC;
}

- (NSString *)jsonFromArray:(NSArray *)aArray {
NSData *data=[NSJSONSerialization dataWithJSONObject:aArray options:NSJSONWritingPrettyPrinted error:nil];
if (data == nil) {
return nil;
}
NSString *str=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return str;
}

你可能感兴趣的:(我遇到的那些坑)