我正在测试我的应用程序,推动它非常努力,我让它崩溃(黑屏,图像不保存,回落到跳板).但是,我没有在控制台中记录崩溃报告.当我使用探查器进行测试时,我得到的是一条消息,说目标已经死亡,但它没有提供任何线索.
在组织者中,我得到了设备崩溃日志,这给了我这个,我相信它告诉我,我正在向我发布的内容发送消息(objc-msgSend + 22)?我在这里走在正确的轨道上吗?
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x576e6f69
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x34f8ef7e objc_msgSend + 22
1 CoreFoundation 0x371d7e90 CFRetain + 76
2 CoreFoundation 0x371e1b74 +[__NSArrayI __new::] + 48
3 CoreFoundation 0x371e1a8e -[__NSPlaceholderArray initWithObjects:count:] + 294
4 CoreFoundation 0x371e9394 -[NSArray initWithArray:range:copyItems:] + 756
5 CoreFoundation 0x371fcd5a +[NSArray arrayWithArray:] + 66
6 AVFoundation 0x335da766 -[AVCaptureSession outputs] + 146
7 AVFoundation 0x335de26e -[AVCaptureSession _doDidStop:] + 38 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用javascript API简单地使用Leap Motion获取滑动手势的方向.我的代码是:
$(document).ready(function() {
controller = new Leap.Controller("ws://localhost:6437/");
listener = new Leap.Listener();
listener.onFrame = function(controller) {
var frame = controller.frame();
var hands = frame.hands();
var pointables = frame.pointables();
var gestures = frame.gestures();
$("#rotationAxis").text(pointables.length);
$("#gestureDetected").text(gestures[0]);
}
controller.addListener(listener);
controller.enableGesture("swipe", true);
listener.onConnect = function(controller) {
// calibrate = new Leap.Calibrate(controller);
// calibrate.onComplete = function(screen){
// }
}
});
Run Code Online (Sandbox Code Playgroud)
我可以从数组中获取当前手势,但无法获取类型或方向.有任何想法吗?
谢谢.
我试图让一个简单的条件语句工作,并遇到问题.失败的代码:
$(document).ready(function(){
var wwidth = $(window).width();
if (wwidth < 321) {
alert("I am 320 pixels wide, or less");
window.scrollTo(0,0);
} else if (wwidth > 321) && (wwidth < 481) {
alert("I am between 320 and 480 pixels wide")
}
});
Run Code Online (Sandbox Code Playgroud)
如果我删除了else代码的一部分,我会收到警报.如果我尝试使用&&或|| 操作员会失败.我用谷歌搜索,我找不到它为什么不起作用的原因.我也尝试过:
((wwidth > 321 && wwidth < 481))
Run Code Online (Sandbox Code Playgroud)
以及其他方式,以防万一它是一些奇怪的语法.
任何帮助将不胜感激.谢谢 :)
我有一个相机预览窗口,90%的时间都运行良好.但是,有时候,如果返回我的应用程序,如果它在后台,则不会显示预览.这是我在视图加载时调用的代码:
- (void) startCamera {
session = [[AVCaptureSession alloc] init];
session.sessionPreset = AVCaptureSessionPresetPhoto;
AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
captureVideoPreviewLayer.frame = _cameraView.bounds;
[_cameraView.layer addSublayer:captureVideoPreviewLayer];
captureVideoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
captureVideoPreviewLayer.position=CGPointMake(CGRectGetMidX(_cameraView.bounds), 160);
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
NSLog(@"ERROR: %@", error);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Important!"
message:@"Unable to find a camera."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert autorelease];
}
[session addInput:input];
stillImage = [[AVCaptureStillImageOutput alloc] init];
NSDictionary *outputSettings = [[NSDictionary …Run Code Online (Sandbox Code Playgroud) <> <> ---- Aalok回答了这个问题,我只是在等他写出来,所以我可以选择那个作为正确的答案.在此之前,随着他在下面描述的更改,我不得不调用 - self.library = [[ALAssetsLibrary alloc] init]; - 每次尝试保存图像之前.作为预防措施,我也停止了AVSession运行,直到保存之后,何时重新启动(使用[session stopRunning];和[session startRunning]; ----- <> <>
<> <> -----编辑2:您无需停止并重新启动AV会话,对此进行了彻底测试,并且运行正常.----- <> <>
<> <> -----编辑3:在我的设备上对此进行彻底测试后,它完美运行,一旦完成审核流程并放入商店,代码就无法运行.两个相同的设备(2x iPhone 4)运行相同的操作系统,一个使用我的开发构建,一个关闭app sotre,ap商店版本仍然有bug.现在放弃这个----- <> <>
我正在使用此链接中的类别尝试保存到自定义文件夹:
http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/
现在它在某些时候有效,但不是全部.在评论中,有人建议以下代码检测组属性是否为零:
if ([group valueForProperty:ALAssetsGroupPropertyURL] == nil)
{
NSLog(@”group properties are nil!”);
} else {
[group addAsset:asset];
}
Run Code Online (Sandbox Code Playgroud)
我有,它确实检测属性是否为零.一切都很好.我正在努力的是在那时设置属性并保存图像.我猜这时我们可以手动设置albumName并保存图片,我试过了,但错误仍然存在.
有任何想法吗?谢谢.
我正在上课来处理我所有的iBeacon测试.它的目的是开始寻找区域,范围信标,识别它们然后发送通知.代码如下.
我遇到的问题是应用程序运行速度非常慢,我知道iBeacons有延迟问题,有时只是停止工作(不会识别关闭信标).我知道,我的代码很混乱,在我清理它之前尝试对逻辑进行排序.我想知道我是否错过了一个逻辑缺陷(我的意思是,我想知道我引入了哪些逻辑漏洞!).
#import "dcBeaconManager.h"
@implementation dcBeaconManager
@synthesize currentBeaconState;
bool testRanging = false;
int firstRegionEntered = 0;
int beaconsRangedCount = 0;
- (void)initBeaconManager {
NSLog(@"initBeaconManager called");
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
NSUUID *uuid = [[NSUUID alloc]initWithUUIDString:@"B9407F30-F5F8-466E-AFF9-25556B57FE6D"];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"digiConsRegion"];
[self.locationManager startMonitoringForRegion:self.beaconRegion];
[self.locationManager requestStateForRegion:self.beaconRegion];
currentBeaconState = @"initial";
}
- (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region {
NSLog(@"Started looking for regions");
[self.locationManager requestStateForRegion:self.beaconRegion];
}
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(@"Region discovered");
if (firstRegionEntered == 0) {
NSLog(@"First time …Run Code Online (Sandbox Code Playgroud) 我在两天前运行正常的一些代码上收到错误.错误是:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType extent]: unrecognized selector sent to instance 0x1bc8f0'
Run Code Online (Sandbox Code Playgroud)
它指向main.m上的这一行:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
Run Code Online (Sandbox Code Playgroud)
使用日志来查看我的代码到达的位置似乎这行引发了错误:
greySave = [context createCGImage:greyscaleImage fromRect:[greyscaleImage extent]];
Run Code Online (Sandbox Code Playgroud)
greySave是一个CGImageRef,在我的视图控制器的开头声明.抓取CIImage输出并将其转换为CGImageRef进行保存非常简单:
desaturate = [CIFilter filterWithName:@"CIColorMonochrome" keysAndValues:kCIInputImageKey, colourSave, @"inputIntensity", [NSNumber numberWithFloat:0.00], nil];
greyscaleImage = [desaturate valueForKey:@"outputImage"];
greySave = [context createCGImage:greyscaleImage fromRect:[greyscaleImage extent]];
Run Code Online (Sandbox Code Playgroud)
我认为唯一改变的东西(虽然不明白为什么)可能导致问题是添加一个额外的条件语句,这将应用第二个过滤器是用户希望这样做:
if ([_alphaButtonSavedState isEqualToString:@"ON"]) {
NSLog(@"user does want alpha on greyscale");
//user wants alpha mask also
} else {
NSLog(@"user does not want alpha on greyscale");
//convert …Run Code Online (Sandbox Code Playgroud) 我已经尝试了所有我在SO上找到的答案,所以要么我有不同的问题,要么热量进入我的大脑.
无论如何,我在故事板上有一个UIButton,它链接到一个名为_cameraButtonPress的IBAction(UIButton被称为_cameraButton).当按下按钮时我想禁用按钮一段时间,所以我立即调用[sender setEnabled:NO]; 这很好用.但是,在保存图像的不同功能中,成功保存后我使用[_cameraButton.setEnabled:YES]; 这不起作用.
如果我在IBAction调用的函数中用_cameraButton替换sender,这也不起作用.我把UIButton链接到IBOutlet.
我可以发布代码,但现在这是一个非常大的项目,以下是相关内容:
在标题中......
IBOutlet UIButton *_cameraButton;
Run Code Online (Sandbox Code Playgroud)
IBAction ......
- (IBAction) _cameraButtonPress:(id)sender {
[sender setEnabled:NO]; //stops button responding to touch events
Run Code Online (Sandbox Code Playgroud)
进一步降低功能:
} else {
NSLog(@"colour image saved successfully");
[_cameraButton setEnabled:YES];
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
谢谢.
我有一个简单的条件失败:
NSNumber *beaconMajor = [NSNumber numberWithInt:33995];
NSNumber *beaconMinor = [NSNumber numberWithInt:59204];
NSNumber *incommingMajor = beacon.major;
NSNumber *incommingMinor = beacon.minor;
NSLog(@"%d", [beaconMajor integerValue]);
NSLog(@"%d", [incommingMajor integerValue]);
NSLog(@"Pre big conditional");
//if the beacon is the one for the test content AND we are very near to it, show that content
if (incommingMinor == beaconMinor) {
NSLog(@"Into big conditional");
if (beacon.proximity == CLProximityImmediate) {
[self performSegueWithIdentifier:@"mainToContent" sender:self];
}
}
Run Code Online (Sandbox Code Playgroud)
我正在抓住两个来自iBeacon的NSNumber,并将它们与我知道对应的两个手动设置数字进行比较.记录它们时检查数字,它们是相同的.但是条件不接受它们是相等的因此不会触发.
我看不出有什么不对,你可以看到它非常简单.
有什么想法或建议吗?
谢谢.
我有一个奇怪的问题.我正在从网络音频API中获取数字,我得到的是一个常量列表:
3.1051260268969075e-28等
我想围绕这个数字,但使用:
Math.round(magAmount);
Run Code Online (Sandbox Code Playgroud)
始终返回0. magAmount是我存储数字的变量.另一个奇怪的是,如果我将数字乘以5,我得到的值低于原始值,在本例中为1.5525630134484537e-27.
有任何想法吗?
谢谢.
ios ×6
javascript ×3
jquery ×2
cgimageref ×1
conditional ×1
core-image ×1
crash ×1
events ×1
gesture ×1
ibaction ×1
ibeacon ×1
iboutlet ×1
ios5 ×1
iphone ×1
leap-motion ×1
math ×1
nserror ×1
objective-c ×1
operators ×1
profiler ×1
rounding ×1
save ×1
uibutton ×1
uiview ×1