小编Par*_*iya的帖子

UIDocumentInteractionController"invalid scheme(null)"

我正在尝试使用UIDocumentInteractionController预览文档.该文档是我的应用程序从网上下载的.xls文件.我一直收到这个错误:

'UIDocumentInteractionController: invalid scheme (null).  Only the file scheme is supported.'
Run Code Online (Sandbox Code Playgroud)

我用下一个代码:

- (void) webServiceController:(WebServiceController *)webServiceController returnedArray:(NSMutableArray *)array {
    if ([webServiceController.webRequest isEqualToString: @"generateExcelFileForEmployee"]) {
        // start previewing the document at the current section index
        NSString *link = [[NSString stringWithString:array[0]] stringByReplacingOccurrencesOfString:@"AdminFunctions.php" withString:@"AdminFunctions.xls"];
        link = [[[link stringByReplacingOccurrencesOfString:@"\\" withString:@""]stringByReplacingOccurrencesOfString:@"/public/sites/" withString:@"http://"]stringByReplacingOccurrencesOfString:@"\"\\\"" withString:@""];
        NSLog(@"%@", link);
        NSData *urlData = [NSData dataWithContentsOfURL:[NSURL URLWithString:link]];

        NSArray   *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString  *documentsDirectory = [paths objectAtIndex:0];

        NSString  *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"AdminFunctions.xls"];

        BOOL isWriteSuccess = [urlData writeToFile:filePath atomically:YES];
        NSLog(@"%@", …
Run Code Online (Sandbox Code Playgroud)

excel preview nsdata ios uidocumentinteraction

22
推荐指数
1
解决办法
7865
查看次数

无需为开发人员使用Xcode 7进行代码签名

如果开发人员没有需要或使用Xcode 7进行代码签名,那么如何使用xcode 7 realease实现.

因为它仍然显示错误: CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 9.0'

有可能吗?

xcode objective-c ios

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

在iOS 7.0 AVSpeechSynthesizer中有美国男声吗?

解决方案:它没有US male voice


我已经习惯AVSpeechSynthesizer frameworkiOS7.0

AVSpeechUtterance *utt = [AVSpeechUtterance speechUtteranceWithString:@"Hello"]; 
if (isMale) //flag for male or female voice selected
{
    // need US male voice as en-US is providing only US female voice
    utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"]; //UK male voice 
}
else
{
    utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; //US female voice
}
Run Code Online (Sandbox Code Playgroud)

我需要用US male voice而不是male UK voice.

iphone objective-c ios ios7 avspeechsynthesizer

11
推荐指数
1
解决办法
4475
查看次数

iOS通用开发 - 在Xib文件和图像名称中使用Tilde Sign(〜)进行区分

在开发过程中universal apps,我们必须conditional code为每个人写一个device- iPad以及iPhone.在这种情况下,正确使用tilde可能是非常有益的.

例如,如果你想推送新的视图控制器,那么你必须编写很多代码行(差不多10行):

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
  MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@”MasterViewController_iphone” bundle:nil];
 [self.navigationController pushViewController:masterViewController animated:YES];
 [masterViewController release];
}
else
{
  MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@”MasterViewController_ipad” bundle:nil];
  [self.navigationController pushViewController:masterViewController animated:YES];
  [masterViewController release];
}
Run Code Online (Sandbox Code Playgroud)

我们如何区分iphone和ipad的图像?

iphone xcode objective-c ios

10
推荐指数
1
解决办法
5019
查看次数

如何使用AFNetworking或STHTTPRequest来请求SOAP Web服务?

我能够使用NSMutableURLRequestNSURLConnection连接到SOAP Web服务,具体如下:

NSString *soapMessage = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                         "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                         "<soap:Body>"
                         "<CelsiusToFahrenheit xmlns=\"http://www.w3schools.com/webservices/\">"
                         "<Celsius>140.0</Celsius>"
                         "</CelsiusToFahrenheit>"
                         "</soap:Body>"
                         "</soap:Envelope>"];

NSData *soapData = [soapMessage dataUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:@"http://w3schools.com/webservices/tempconvert.asmx"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[soapMessage length]];

[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: @"http://www.w3schools.com/webservices/CelsiusToFahrenheit" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:@"www.w3schools.com" forHTTPHeaderField:@"Host"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:soapData];
Run Code Online (Sandbox Code Playgroud)

我怎么能使用AFNetworkingSTHTTPRequest做同样的事情

iphone objective-c ios afnetworking sthttprequest

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

UIView's viewPrintFormatter is not able to create PDF

Note : UIWebView to PDF working for me.

Now UIView to PDF is also option but wanted to work with below code as same as used to create PDF in UIWebView.

I have done below code so far for UIView's viewPrintFormatter to be able create PDF:

Added Category of UIPrintPageRenderer for getting PDF Data

@interface UIPrintPageRenderer (PDF)
- (NSData*) printToPDF;
@end

@implementation UIPrintPageRenderer (PDF)
- (NSData*) printToPDF
{
  NSMutableData *pdfData = [NSMutableData data];
  UIGraphicsBeginPDFContextToData( pdfData, self.paperRect, nil );
  [self prepareForDrawingPages: …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

7
推荐指数
0
解决办法
1068
查看次数

Objective-C内置模板系统?

我正在开发一个iPhone应用程序,我使用HTML来显示格式化的文本.

我经常显示相同的网页,但内容不同.我想使用模板HTML文件,然后用我的不同值填充它.

我想知道Objective-C是否有类似于Ruby中的ERB的模板系统.

这样就可以做到这样的事情

模板:

<HTML>
  <HEAD>
  </HEAD>
  <BODY>
    <H1>{{{title}}}</H1>
    <P>{{{content}}}</P>
  </BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)

Objective-C(或者它可能在理想世界中)

Template* template = [[Template alloc] initWithFile:@"my_template.tpl"];
[template fillMarker:@"title" withContent:@"My Title"];
[template fillMarker:@"content" withContent:@"My text here"];
[template process];
NSString* result = [template result];
[template release];
Run Code Online (Sandbox Code Playgroud)

结果字符串将包含:

<HTML>
  <HEAD>
  </HEAD>
  <BODY>
    <H1>My Title</H1>
    <P>My text here</P>
  </BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)

上面的例子可以通过一些文本替换来实现,但这将是一个难以维护.我还需要像模板中的循环一样的东西.例如,如果我要显示多个项目,我想生成多个div.

谢谢阅读 :)

templates file objective-c

6
推荐指数
1
解决办法
3715
查看次数

AVPlayer 设置初始播放时间 iOS

增加了KVOAVPlayer当播放视频queuePlayerAVPlayer

[self.queuePlayer addObserver:self forKeyPath:@"status" options:0 context:NULL];
Run Code Online (Sandbox Code Playgroud)

observer method

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
  if ([keyPath isEqualToString:@"status"]) {
    if (self.queuePlayer.status == AVPlayerStatusReadyToPlay) {

        NSInteger step = (NSInteger)(startTimeForVideo/0.04);
        [self.queuePlayer.currentItem stepByCount:step];

        //CMTime seekTime = CMTimeMake(startTimeForVideo*timeScale,timeScale);
        //if (CMTIME_IS_VALID(seekTime)) 
        //  [self.queuePlayer seekToTime:seekTime toleranceBefore:kCMTimePositiveInfinity toleranceAfter:kCMTimePositiveInfinity];
        //else
        //  NSLog(@"In valid time");

        [self.queuePlayer play];
    } else if (self.queuePlayer.status == AVPlayerStatusFailed) {
        /* An error was encountered */
    }
}
Run Code Online (Sandbox Code Playgroud)

这里startTimeForVideo初始playBack timevideo

seekToTime …

iphone objective-c ios avplayer

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

使用NSPredicate iOS在具有NSString的NSArray的NSArray中查找值

随着NSArray只有我能找到值:

NSArray *arr = [NSArray arrayWithObjects:@"299-1-1", @"299-2-1", @"299-3-1", @"399-1-1", @"399-2-1", @"399-3-1", @"499-1-1", @"499-2-1", @"499-3-1", nil];
NSString *search = @"299";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS %@",[NSString stringWithFormat:@"%@", search]];
NSArray *array = [arr filteredArrayUsingPredicate: predicate];
NSLog(@"result: %@", array);
Run Code Online (Sandbox Code Playgroud)

Found Result 正如所料:

 result: (
 "299-1-1",
 "299-2-1",
 "299-3-1"
 )
Run Code Online (Sandbox Code Playgroud)

但对于NSArrayNSArrayNSString

NSArray *arr = [NSArray arrayWithObjects:[NSArray arrayWithObjects:@"299-1-1", nil],[NSArray arrayWithObjects:@"399-1-1", nil],[NSArray arrayWithObjects:@"499-1-1", nil], nil];
Run Code Online (Sandbox Code Playgroud)

会在predicate syntax这里?????

iphone objective-c nspredicate ios

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

iOS 内容从水平到垂直并带有动画,反之亦然

我们可以通过UIStackView最初的垂直轴然后最终它将是水平轴来实现这一点,反之亦然吗?

如果使用NSAutoLayout,如何做到这一点?

如果有人可以为我提供示例来源或此处的任何提示都会有所帮助,则需要帮助。

我找到了这个Android库

需要这样的动画

ios swift uistackview

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

在iPhone屏幕上使用多点触控检测左手或右手

下图为橙色区域,放置婴儿手掌.所有我需要知道如何检测婴儿plam是正确还是左.

在此输入图像描述

iphone objective-c multi-touch uitouch ios

-1
推荐指数
1
解决办法
639
查看次数