小编Dan*_*iel的帖子

从iOS中的视频网址或数据中获取缩略图

我试图从iphone 3GS相机拍摄的视频中获取(第一帧的)缩略图,以便我可以显示它.这该怎么做?

iphone video thumbnails ios

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

Iphone SDK通过点击它来解除ipad上的Modal ViewControllers

我想在用户点击模态视图时解雇FormSheetPresentation模式视图控制器...我已经看到一堆应用程序这样做(例如在ipad上的ebay)但我无法弄清楚如何从触摸中禁用底层视图当模态视图像这样显示时(他们是否可能将它呈现为一个弹出窗口?)......任何人都有任何建议吗?

iphone modal-view ipad

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

在iOS中获取设备ID或Mac地址

我有一个使用rest来与服务器通信的应用程序,我想获取iphone的mac地址或设备ID以进行唯一性验证,如何做到这一点?

mac-address objective-c device ios

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

iOS UITextField-解雇自定义inputView

我正在为某些文本字段使用自定义inputView,但是当我在文本字段上调用resignFirstResponder时,自定义输入视图不会忽略...任何建议?

UITextField *f=[[UITextfield alloc] init];
 UIView *view=[[UIView alloc] initWithFrame..];
   [f setInputView:view]; //random example of how to set a textfields input view to a custom view
Run Code Online (Sandbox Code Playgroud)

经过一些研究,只有在使用模态视图中呈现的viewController时才会出现此问题...否则正常工作...

谢谢

-Daniel

uitextfield ios inputview

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

WCF WebInvoke ResponseFormat

我有一个WCF restul服务,我想让用户选择他们想要的请求格式,我有装饰

    [OperationContract]
    [WebInvoke(Method = "GET", 
        ResponseFormat = WebMessageFormat.Xml, 
        BodyStyle = WebMessageBodyStyle.Wrapped, 
        UriTemplate = "getstreamurl?ch={ch}&format=xml")]
    [WebInvoke(Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "getstreamurl?ch={ch}&format=json")]
Run Code Online (Sandbox Code Playgroud)

首先,有没有办法在运行时指定ResponseFormat并将格式作为方法的参数?从阅读周围我不这么认为......好的下一件事上面的代码是好的并且有效,但我有问题,我希望能够指定一个默认值,所以当没有格式争论传递然后我只是默认但如果我这样装饰

    [WebInvoke(Method = "GET", 
        ResponseFormat = WebMessageFormat.Xml, 
        BodyStyle = WebMessageBodyStyle.Wrapped, 
        UriTemplate = "getstreamurl?ch={ch})]

    [OperationContract]
    [WebInvoke(Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "getstreamurl?ch={ch}&format=json")]
Run Code Online (Sandbox Code Playgroud)

在XML是默认值的情况下,如果我尝试通过浏览器调用服务方法,它会告诉我:

UriTemplateTable不支持具有与模板'getstreamurl?ch = {ch}'等效路径的多个模板,但具有不同的查询字符串,其中查询字符串不能通过文字值消除歧义.有关更多详细信息,请参阅UriTemplateTable的文档

它们显然可以区分,但似乎WCF只是阅读论证并认为它...任何建议?

rest wcf responseformat

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

为WCF webhttp设置最大消息和缓冲区大小

我目前有一个带有webHttp绑定的WCF服务,我试图通过覆盖config中的默认设置来增加可以输入到服务的最大大小,我试过做类似的事情

  <system.serviceModel>
<bindings>
<webHttpBinding>
  <binding name="webHttp" >
  <security mode="Transport">
      <transport clientCredentialType = 
             "None"
            proxyCredentialType="None"
            realm="string" />
  </security>
  </binding>

</webHttpBinding>
</bindings>
<services>

  <service name="PrimeStreamInfoServices.Service1" behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="webHttpBinding"  contract="PrimeStreamInfoServices.IService1">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="PrimeStreamInfoServices.Service1Behavior">
      <!-- To avoid disclosing metadata …
Run Code Online (Sandbox Code Playgroud)

size wcf message webhttp

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

使 valgrind 能够在 C++ 需要时读取用户输入

我正在尝试使用 valgrind 运行我的 C++ 程序,但是我在程序中有一些需要用户从 stdin 输入的点,但是当我使用 valgrind 运行时,它不会让用户为程序输入任何内容,有没有办法解决这个问题?

四处寻找,但没有找到答案。

c++ valgrind user-input

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

采用iCloud设计的核心数据

我在iOS 7上想要使用iCloud的核心数据,这很好用,我想要输入的问题如下.

我的一些核心数据对象具有相关图像/大文本文件,我将其作为文件存储在文件系统中,只是将这些项目的URL设置为字符串属性.现在显然这不会与iCloud核心数据同步一起工作,因为iCloud没有这些文件的概念.我想知道你是否有任何关于如何处理这个问题的建议?

1)我可以直接将图像数据和大文本文件存储为核心数据属性,但它似乎不是最好的方法

2)我可以使用iCloud来存储文件,然后以某种方式尝试在不同iOS设备中的文件之间保持同步,但这可能会变得混乱.

3)其他一些解决方案.

有什么建议?

问候

丹尼尔

core-data ios icloud

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

使用ssl(https)的POST的WCF问题

我目前有一个webHttp绑定WCF restful服务,它比http工作得很好,我可以根据我的webconfig设置制作大尺寸的帖子,现在我试图通过https(ssl)使用它,现在我的工作正常,但我的帖子不,当文件大小超过一定数量时它不起作用,我想知道为什么这可能是因为我的webconfig指定了更大的尺寸并且它在http上运行良好,这里是我的相关webconfig ..任何建议

谢谢

<system.serviceModel>
<client>
  <endpoint binding="webHttpBinding" bindingConfiguration="webHttp"
    contract="PrimeStreamInfoServices.IService1" name="Client" />
</client>
<bindings>
  <webHttpBinding>
    <binding name="webHttp" maxBufferSize="15000000" maxBufferPoolSize="15000000"
      maxReceivedMessageSize="15000000">
      <readerQuotas maxDepth="15000000" maxStringContentLength="10000000" 
        maxArrayLength="15000000" maxBytesPerRead="15000000" maxNameTableCharCount="10000000" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="string" />
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior"
    name="PrimeStreamInfoServices.Service1">
    <endpoint address="" binding="webHttpBinding"
      bindingConfiguration="webHttp" contract="PrimeStreamInfoServices.IService1" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="PrimeStreamInfoServices.Service1Behavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceCredentials>
        <!--
        <serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="TempCa" />
          -->
      </serviceCredentials>

    </behavior>
  </serviceBehaviors>
</behaviors>
<diagnostics> …
Run Code Online (Sandbox Code Playgroud)

ssl https wcf post webhttp

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

从AVAssetReaderOutput读取数据时,iOS 5.0崩溃

我有这段代码用于从中读取数据AVAssetReaderOutput,该方法在iOS 4.0中运行良好,但是在5.0中它以最糟糕的访问方式崩溃,不知道为什么,任何人都有任何输入?

AVAssetReaderOutput *output=[myOutputs objectAtIndex:0];
 int totalBuff=0;
while(TRUE)
{
     CMSampleBufferRef ref=[output copyNextSampleBuffer];
    if(ref==NULL)
        break;
    //copy data to file
    //read next one
    AudioBufferList audioBufferList;
    NSMutableData *data=[[NSMutableData alloc] init];
    CMBlockBufferRef blockBuffer;
    CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(ref, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);

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


    NSLog(@"Gonna write %d", audioBuffer.mDataByteSize);
    //crashes here
    [data appendBytes:frame length:audioBuffer.mDataByteSize];



}

totalBuff++;
CFRelease(blockBuffer);
CFRelease(ref);


   [fileHandle writeData:data];
    [data release];
}
Run Code Online (Sandbox Code Playgroud)

谢谢

丹尼尔

iphone audio avfoundation ios ios5

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

C++在这里发生了什么

假设我有一个包含Records的类TwoWayList,而GetRec实际上在堆上创建了一个新列表,这里是方法

void GetRec(TwoWayList<Record> &rec)
{
   TwoWayList<Record>* list= new TwoWayList<Record>();
   Record r;
   list->Insert(&r);
}
Run Code Online (Sandbox Code Playgroud)

现在我有以下两个场景,第一个在我调用delete时死亡,另一个我只是得到一个空的引用记录,所以当我调用MoveToStart()我得到一个段错误,但是如果我只是删除它工作. ..

int main () {
    TwoWayList<Record> record;
    GetRec(record);
    record.MoveToStart();
    delete &record;//crash
   return 0;
}

int main () {
    TwoWayList<Record> *record;
    GetRec(*record);
    record->MoveToStart(); //segfault
    delete record;
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

那么最近怎么样?我在方法的堆中创建一个TwoWayList,因此我不能删除(事实上,如果我不删除它不会是泄漏吗?)是什么方法从这里的方法获取TwoWayList以便我以后可以删除吗?

谢谢

丹尼尔

c++ memory-management new-operator

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

我正在初始化两个NSArrays.为什么一个人工作而另一个人失败?

我正在尝试使用以下代码初始化两个NSArrays

self.fillingTypes = [[NSArray alloc] initWithObjects:@"Ham",@"Turkey",@"Peanut Butter", @"Tuna Salad",@"Roast Beef",@"Vegemite", nil];

self.breadTypes = [[NSArray alloc] initWithObjects:@"White",@"Whole Wheat", @"Rye", "@Sourdough", @"Seven Grain", nil];`
Run Code Online (Sandbox Code Playgroud)

fillingTypes数组有效,但breadTypes数组崩溃发送EXC_BAD_ACCESS错误.当我逐步完成它时,breadTypes数组说"变量不是CFArray".为什么一个阵列工作而另一个阵列失败?

objective-c ios5 xcode4.3

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