小编owe*_*rig的帖子

如何追踪SIGABRT的原因

我出于示例目的显示了此问题的代码,但实际上我的问题是:我应该如何跟踪并理解SIGABRT错误?我读到了这个问题:没有错误信息的sigabrt,但我不认为这与我的问题有关.

我将在下面展示的示例显然不是xib问题,之前获得SIGABRT似乎更多地与未处理的异常有关.我尝试过使用GDB,bt但这没有用.是否没有更全面的转储可供查看?我也使用过NSZombie,但我真的不明白如何使用它,所以如果这是你的答案,请提供一个文档的链接,说明我应该如何从中获取相关数据.

这是我的例子:我正在尝试使用Core Data.我的项目最初并没有设置它,所以我不得不手动添加它,我通过转到我的项目> Build Phases> Link Binary with Libraries>点击加号并添加CoreData.framework

然后我通过转到文件>新建>数据模型创建了我的数据模型.我创建了很多属性,就是这样

之后,我向app委托添加了正确的方法(我通过使用Core Data创建一个新项目,然后复制方法来完成此操作):

//code removed, as its not needed for the question/answer
Run Code Online (Sandbox Code Playgroud)

在此之后,我只是尝试将值保存到托管对象(再一次,使用新项目从默认实现复制代码):

//code removed, as its not needed for the question/answer
Run Code Online (Sandbox Code Playgroud)

但是,当我执行该addTime方法时,我得到的只是SIGABRT错误.

xcode错误

crash cocoa-touch objective-c sigabrt

41
推荐指数
1
解决办法
4万
查看次数

如何将短数组转换为字节数组

我发现将一个短数组转换为字节数组,将字节数组转换为短数组,但不是短数组转换为字节数组.

以下是导致转换的代码

while(!stopped)
        { 
            Log.i("Map", "Writing new data to buffer");
            short[] buffer = buffers[ix++ % buffers.length];

            N = recorder.read(buffer,0,buffer.length);
            track.write(buffer, 0, buffer.length);

            byte[] bytes2 = new byte[N];
Run Code Online (Sandbox Code Playgroud)

我试过了

              int i = 0;
              ByteBuffer byteBuf = ByteBuffer.allocate(N);
              while (buffer.length >= i) {
                  byteBuf.putShort(buffer[i]);
                  i++;
        }

bytes2 = byteBuf.array();
Run Code Online (Sandbox Code Playgroud)

    ByteBuffer.wrap(bytes2).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().put(buffer);
Run Code Online (Sandbox Code Playgroud)

但是我在两者上都收到了这个错误(错误如果不完全相同但两者非常相似):

05-29 13:41:12.021:W/AudioTrack(9758):gainBuffer()轨道0x30efa0禁用,重启

05-29 13:41:12.857:W/AudioWorker(9758):读取语音AudioWorker时出错

05-29 13:41:12.857:W/AudioWorker(9758):java.nio.BufferOverflowException

05-29 13:41:12.857:W/AudioWorker(9758):at java.nio.ShortBuffer.put(ShortBuffer.java:422)

05-29 13:41:12.857:W/AudioWorker(9758):at java.nio.ShortToByteBufferAdapter.put(ShortToByteBufferAdapter.java:210)

05-29 13:41:12.857:W/AudioWorker(9758):at java.nio.ShortBuffer.put(ShortBuffer.java:391)

05-29 13:41:12.857:W/AudioWorker(9758):at com.avispl.nicu.audio.AudioWorker.run(AudioWorker.java:126)

并且只是在这里提供尽可能多的信息是使用字节数组之后的代码

Log.i("Map", "test");
                //convert to ulaw
                read(bytes2, …
Run Code Online (Sandbox Code Playgroud)

java arrays

15
推荐指数
2
解决办法
2万
查看次数

如何使用 HttpClient 发出 OPTIONS 请求

如何使用 System.Net.Http.HttpClient 发送 OPTIONS 请求

HttpClient 的公开方法

  • 删除异步
  • 获取异步
  • 异步后
  • 异步
  • 还有其他几个......

我期待 OptionsAsync

   switch (httpMethod) {
      case HTTP_METHODS.DELETE:
       {
        httpResponseMessage = httpClient.DeleteAsync(uri).Result;
        break;
       }
      case HTTP_METHODS.GET:
       {
        httpResponseMessage = httpClient.GetAsync(uri).Result;
        break;
       }
      case HTTP_METHODS.POST:
       {
        httpResponseMessage = httpClient.PostAsync(uri, httpContent).Result;
        break;
       }
      case HTTP_METHODS.PUT:
       {
        httpResponseMessage = httpClient.PutAsync(uri, httpContent).Result;
        break;
       }
      case HTTP_METHODS.OPTION:
       {
        //not sure what method to call on httpclient here to make Options request
        httpResponseMessage = httpClient.PutAsync(uri, httpContent).Result;
        if (httpResponseMessage.Headers.Contains("X-CSRF-TOKEN")) {
         IEnumerable < string > headerValues = …
Run Code Online (Sandbox Code Playgroud)

c# http dotnet-httpclient

9
推荐指数
1
解决办法
2869
查看次数

球衣休息问题

我总是最终得到"ResourceConfig实例不包含任何根资源类"错误

我甚至不需要除了jersey-bundle以外的任何东西但没有它我会得到关于asm.jar的错误

package akiraapps.jerseytest;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class Hello {

    // This method is called if TEXT_PLAIN is request
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayPlainTextHello() {
        return "Hello Jersey";
    }

    // This method is called if XML is request
    @GET
    @Produces(MediaType.TEXT_XML)
    public String sayXMLHello() {
        return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>";
    }

    // This method is called if HTML is request
    @GET
    @Produces(MediaType.TEXT_HTML)
    public String sayHtmlHello() {
        return "<html> " + …
Run Code Online (Sandbox Code Playgroud)

jersey

7
推荐指数
1
解决办法
3万
查看次数

使用GCDAsyncSocket通过套接字进行Telnet

我正在尝试通过telnet从目标c连接到Cisco C40编解码器.在我的电脑上使用终端时,我得到:

密码:

但是,在进行套接字连接时,需要进行telnet协商.我是哪个但由于某种原因,我无法进入上面的"密码:"提示.

- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{
    NSLog(@"RECEIVE BUFFER %@",data);

    //store read bytes to rawData
    self.rawData = [[NSMutableData alloc] initWithData:data];

    //cast bytes
    const uint8_t *bytes = [self.rawData bytes];

    //go through rawdata format and save it to networkbuffer
    for (int i =0; i < [self.rawData length]; i++)
    {
        if (![[NSString stringWithFormat:@"%02X", bytes[i]]isEqual:@"0D"])
        {
            [self.networkBuffer addObject:[NSString stringWithFormat:@"%02X", bytes[i]]];
        }
    }

    //negotiate any telnet protocal stuff (just accept options )
    //example:
    //FF:FD:18 returns FF:FB:18
    while([[self.networkBuffer objectAtIndex:0]isEqualToString:@"FF"] && [[self.networkBuffer objectAtIndex:1]isEqualToString:@"FD"] …
Run Code Online (Sandbox Code Playgroud)

telnet objective-c

7
推荐指数
1
解决办法
2954
查看次数

由客户端看不到相同类型的Web服务引发的自定义异常(使用共享程序集)

我创建了一个自定义异常InvalidSessionException.但是,当尝试捕获或评估引发的异常是否属于该类型时,它不起作用.这意味着既EX isCatch Ex,不计算InvalidSessionException

try 
{
    acc = this.fda.GetAccountHeader(this.selectedTicket.AccountId);
}  
catch (Exception ex) 
{
    if (ex is Enterprise.Data.InformationModel.CustomExceptions.InvalidSessionException) 
    {
        this.lblError.Text = Resources.Resource.error_sessionedTimedOut;
        this.MPError.Show();
    }
    return;
}
Run Code Online (Sandbox Code Playgroud)

我也试过(结果没有任何差别)

catch (Enterprise.Data.InformationModel.CustomExceptions.InvalidSessionException ex) 
{
    this.lblError.Text = Resources.Resource.error_sessionedTimedOut;
    this.MPError.Show();
    return;
} 
catch (Exception ex) 
{
    return;
}
Run Code Online (Sandbox Code Playgroud)

据我所知,抛出的异常是正确的类型.

在此输入图像描述

更多信息:

ex.GetType().FullName = "System.ServiceModel.FaultException1[[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"

服务上是否启用了重用类型? 在此输入图像描述

c# wcf web-services exception

7
推荐指数
1
解决办法
1103
查看次数

运动传感器,读取旋转

我在android和ios上都试过这个项目但收效甚微.这个东西很有可能就在我头上.但是我想我会在这里发布我的问题作为最后的努力.
我想弄清楚设备何时旋转或翻转.我的应用程序应该知道它何时执行180,360或者设备是否垂直翻转.
为了理解它的工作方式,我尝试下载两个示例项目:AccelerometerGraph和CoreMotionTeapot.有了这些和其他东西的混合,我发现我正在尝试这个:

motionManager = [[CMMotionManager alloc] init]; 
motionManager.accelerometerUpdateInterval = 0.01;
motionManager.deviceMotionUpdateInterval = 0.01;
[motionManager startDeviceMotionUpdates];

if (motionManager.gyroAvailable) {
    motionManager.gyroUpdateInterval = 1.0/60.0;
        motionManager.deviceMotionUpdateInterval = 0.01;
    [motionManager startGyroUpdatesToQueue:[NSOperationQueue currentQueue]
                               withHandler: ^(CMGyroData *gyroData, NSError *error)
     {
         CMRotationRate rotate = gyroData.rotationRate;
         NSLog(@"rotation rate = [%f, %f, %f]", rotate.x, rotate.y, rotate.z);
     }];
} else {
    NSLog(@"No gyroscope on device.");
}
Run Code Online (Sandbox Code Playgroud)

但我不知道如何从这三个值(x,y,z)收集所要求的信息(水平和垂直旋转).

objective-c ios

5
推荐指数
1
解决办法
8205
查看次数

stream media FROM iphone

I need to stream audio from the mic to a http server.
These recording settings are what I need:

NSDictionary *audioOutputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                             [NSNumber numberWithInt: kAudioFormatULaw],AVFormatIDKey,        
                                             [NSNumber numberWithFloat:8000.0],AVSampleRateKey,//was 44100.0
                                             [NSData dataWithBytes: &acl length: sizeof( AudioChannelLayout ) ], AVChannelLayoutKey,
                                             [NSNumber numberWithInt:1],AVNumberOfChannelsKey,
                                             [NSNumber numberWithInt:64000],AVEncoderBitRateKey,
                                             nil];
Run Code Online (Sandbox Code Playgroud)

API im coding to states:

Send a continuous stream of audio to the currently viewed camera. Audio needs to be encoded at G711 mu-law at 64 kbit/s for transfer to the Axis camera at the bedside. …

audio-streaming ios

5
推荐指数
1
解决办法
5915
查看次数

为什么Tomcat 8.5重新加载上下文

似乎自从我们将tomcat升级到版本8+后,我们就会在启动时获得上下文重新加载.然而,它似乎只发生在我们的开发环境中(带有eclipse和tomcat 8.5的Windows操作系统).我们的生产环境(带有tomcat 8.5的linux OS)没有这个问题.我发布在下面,但我没有看到任何迹象表明为什么这是从tomcat日志发生的事情.我知道这通常会改变网络应用程序目录中的某些行为,但对于我的生活,我无法弄清楚是做什么的.必须有一些方法来追踪它.

这第一块日志是完全启动的

2017年2月18日上午9:53:41 org.apache.tomcat.util.digester.SetPropertiesRule开始警告:[SetPropertiesRule] {Server/Service/Engine/Host/Context}将属性'source'设置为'org.eclipse.jst .jee.server:Stackoverflow-commproxy'找不到匹配的属性.2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:服务器版本:Apache Tomcat/8.5.11 2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:服务器内置:2017年1月10日21:02:52 UTC 2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:服务器号码:8.5.11.0 2017年2月18日9:53 :上午41点org.apache.catalina.startup.VersionLoggerListener日志信息:操作系统名称:Windows 10 Feb 18,2017 9:53:41 AM org.apache.catalina.startup.VersionLoggerListener log INFO:OS Version:10.0 Feb 18,2017上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:架构:amd64 2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:Java主页:C:\ Program Files\Java\jdk1.8.0_91\jre Feb 18,2017 9:53:41 AM org.apache.catalina.startup.VersionLoggerListener log INFO:JVM版本:1.8.0_91-b14 2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:JVM供应商:Oracle Corporation 2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志INFO:CATALINA_BASE:C:\ CodeRepos\work\EclipseWorkspace.metadata.plugins\org.eclipse.wst.server.core\tmp0 2017年2月18日上午9:53:41 org.apache.catalina.startup.VersionLoggerListener日志信息:CATALINA_HOME:C:\ tomcat\apache-tomcat-8.5.11 2017年2月18日上午9:53:41 org.apache. catalina.startup.VersionLoggerListener log INFO:命令行参数:-Dcatalina.base = C:\ CodeRepos\work\EclipseWorkspace.metadata.plugins\org.eclipse.wst.server.core\tmp0 2017年2月18日9:53:41 AM org.apache.catalina.startup.VersionLoggerListener log INFO:命令行参数:-Dcatalina.home = C:\ tomcat\apache-tomcat-8.5.11 2017年2月18日上午9:53:41 org.apache.catalina. startup.VersionLoggerListener log INFO:命令行参数:-Dwtp.deploy = C:\ CodeRepos\work\EclipseWorkspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps 2017年2月18日9:53:41 AM org.apache.catalina.startup.VersionLoggerListener log INFO:逗号 nd …

java tomcat8

5
推荐指数
1
解决办法
4406
查看次数

_CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer的未定义符号

我有这个代码,我试图用来捕获音频数据.然而,编译器抱怨CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer

    -(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
        AudioBufferList audioBufferList;
        NSMutableData *data= [[NSMutableData alloc] init];
        CMBlockBufferRef blockBuffer;
        CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);

        for (int y = 0; y < audioBufferList.mNumberBuffers; y++) {
            AudioBuffer audioBuffer = audioBufferList.mBuffers[y];
            Float32 *frame = (Float32*)audioBuffer.mData;

            [data appendBytes:frame length:audioBuffer.mDataByteSize];
        }
    CFRelease(blockBuffer);
    blockBuffer=NULL;
    [data release];
}
Run Code Online (Sandbox Code Playgroud)

错误:

架构armv7的未定义符号:
"_CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer",引用自: - MicCommunicator.o中的[MicCommunicator captureOutput:didOutputSampleBuffer:fromConnection:] ld:未找到架构armv7 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)

audio ios

2
推荐指数
1
解决办法
1047
查看次数

选择器/方法名称作为字符串参数

所以这段代码有效(将方法名作为字符串发送给接收方法)

[self.Client sendDigitalJoinAndReleaseByName:[NSString stringWithFormat:@"%s",_cmd]];
Run Code Online (Sandbox Code Playgroud)

然而,自从ios 6(我想)我现在得到警告

Format指定类型'char*'但参数的类型为SEL

是否有SEL的格式说明符?这样做的正确方法是什么(这样就没有警告)?

objective-c ios ios6

2
推荐指数
1
解决办法
1140
查看次数

动画块不工作

我试图通过动画顺序更新uilabel,据我所知,标签永远不会动画,只是从默认文本到[tweets objectAtIndex:2]

- (void) statusesReceived:(NSArray *)statuses
               forRequest:(NSString *) connectionIdentifier
{
    for ( NSDictionary *dict in statuses )
    {
        [tweets addObject:[dict objectForKey:@"text" ]];
    }




        tweetsLabel.text = [tweets objectAtIndex:0];
        [tweetsLabel setFont: [UIFont fontWithName:@"Verdana-BoldItalic" size:42]];



        [UIView animateWithDuration:5.5 
                         animations:^{tweetsLabel.transform =CGAffineTransformIdentity;} completion:^(BOOL finished){
                             tweetsLabel.text = [tweets objectAtIndex:1];

        [UIView animateWithDuration:5.5 
                         animations:^{tweetsLabel.transform =CGAffineTransformIdentity;} completion:^(BOOL finished){
                             tweetsLabel.text = [tweets objectAtIndex:2];

                         }];}]; 



    [self.tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)

iphone

0
推荐指数
1
解决办法
349
查看次数

ios中的字节数组

我正在尝试转换此Javascript代码:

self.userSerialEvent = function (join, value, tokens) {
        var type = join.charCodeAt(0);
        var rawJoin = parseInt(join.substr(1)) - 1;
        var rawValue = parseInt(value);
        self.SJValues[join] = value;

        var payload = "\x00\x00" + String.fromCharCode(value.length + 2) + "\x12" + String.fromCharCode(rawJoin) + value;
        self.sendMsg("\x05\x00" + String.fromCharCode(payload.length) + payload);
    };
Run Code Online (Sandbox Code Playgroud)

到ipad应用程序的目标c代码.但是我无法弄清楚如何正确地形成这个如果我做一个char数组我不能有可变长度(这将在将值添加到数组时发生).当我尝试使用NSMutableArray时,我无法插入字节,加上我的网络发送操作需要NSData,我无法将NSMutableArray转换为数据.我也试过NSString但是当我这样做时:

NSString * payload = [NSString stringWithFormat:@"0000%d12%d%@",value.length+2,rawJoin,[value dataUsingEncoding:NSASCIIStringEncoding]];
Run Code Online (Sandbox Code Playgroud)

我得到字符串中的数据周围的<>.我试图创建一个字符集并从字符串中删除"<>",但只删除了最后一个(离开开头<那里)

我的问题是:我如何形成一个字节数组,它具有可变长度并能够将该数组转换为NSData

objective-c ipad ios

0
推荐指数
1
解决办法
9706
查看次数