小编Jag*_*ave的帖子

应用处于后台模式时的文字转语音功能?

我正在开发一款TextToSpeech应用.我在a中写了一段UITextField,然后按下Speak按钮.声音根据文中所写的文字播放UITextField.

在此输入图像描述

但是,当应用程序处于后台模式时,音频将停止播放.如何在后台模式下继续播放声音?类似于音频播放器如何在后台播放歌曲.

我使用以下代码进行文本到语音转换:

#import "ViewController.h"
#import "Google_TTS_BySham.h"
#import <AVFoundation/AVFoundation.h>

@interface ViewController ()

@property (nonatomic,strong)Google_TTS_BySham *google_TTS_BySham;
@property (nonatomic,strong)IBOutlet UITextField *txtString;

@end

@implementation ViewController

#pragma mark - View Life Cycle

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

#pragma mark - Button Tapped event

- (IBAction)btnSpeakTapped:(id)sender{
    NSString *str = [NSString stringWithFormat:@"%@",_txtString.text];
    self.google_TTS_BySham = [[Google_TTS_BySham alloc] init];
    [self.google_TTS_BySham speak:str];
}
Run Code Online (Sandbox Code Playgroud)

objective-c text-to-speech ios background-mode

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

Swift Facebook 登录 AppID 未注册为 URL 方案

我在尝试使用 Facebook 登录时收到以下错误

由于未捕获的异常“InvalidOperationException”而终止应用程序,原因:“fb---AppID---未注册为 URL 方案。请将其添加到您的 Info.plist'

问题是“fb---AppID---”位于我的 Info.plist 文件中。我遵循了此处显示的 FB 文档中列出的 3 个要点。

我直接从文档中复制了应用程序名称和应用程序 ID。我究竟做错了什么?文档中是否缺少步骤?是我在其他地方没有正确配置吗?

在此输入图像描述

facebook info.plist app-id ios parse-platform

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

是否必须为viewWillAppear提供[super viewWillAppear]方法

我在iAd/AdMob广告中放置了我的代码...

-(void)viewWillAppear:(BOOL)animated{}
Run Code Online (Sandbox Code Playgroud)

广告的工作方式非常好,就像我现在在所有iOS设备上使用它们一样.当我将我的iPhone连接到Xcode并点击Product -->Analyze消息时...

子类'iPhoneSIX'中的viewWillAppear:实例方法UIViewController缺少一个[super viewWillAppear:]调用

我偶然偶然发现了这Product-->Analyze件事.[super viewWillAppear]即使所有设备上的所有设备都能正常运行,我是否真的需要添加.如果我不注意Product-->Analyze问题导航器,Apple会拒绝我的应用吗?

还有,......

[super viewWillAppear:YES];
Run Code Online (Sandbox Code Playgroud)

这叫做什么呢?

xcode analyzer appstore-approval viewwillappear ios

3
推荐指数
2
解决办法
5730
查看次数

UIScrollView 相对于 UITableView 和 UICollectionView 的优势

我正在开发一个 MAC 工具,您可以在其中查看UIElementsiOS 应用程序的当前视图控制器层次结构。我曾经用很多第三方应用程序来测试它。据我所知,大多数时候开发人员使用UITableView或来水平或垂直列出某些内容UICollectionView

在测试一些标准应用程序(尤其是电子商务)时,正在使用UIScrollView作为UIView子视图并在其上添加手势。我想理解的是,为什么这些应用程序不使用表格视图或集合来列出某些内容?这背后的原因是什么?

objective-c uitableview uiscrollview ios uicollectionview

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

GoogleMobileAds iOS 9链接错误

我跟着从台阶上这个,因为我已经安装的CocoaPods问题,我手动下载了SDK的压缩,把它添加到项目中,它编译罚款,但我得到了很多的链接错误,因为以下的原因.谢谢你的帮助.

Undefined symbols for architecture x86_64:  
 "_CBCentralManagerOptionShowPowerAlertKey", referenced from:
       l942 in GoogleMobileAds(flat-x86_64)   "_CVBufferGetAttachment", referenced from:
       l2397 in GoogleMobileAds(flat-x86_64)   "_CVOpenGLESTextureCacheCreate", referenced from:
       l2399 in GoogleMobileAds(flat-x86_64)   "_CVOpenGLESTextureCacheCreateTextureFromImage", referenced from:
       l2400 in GoogleMobileAds(flat-x86_64)   "_CVOpenGLESTextureCacheFlush", referenced from:
       l2398 in GoogleMobileAds(flat-x86_64)   "_CVOpenGLESTextureGetName", referenced from:
       l2400 in GoogleMobileAds(flat-x86_64)   "_CVOpenGLESTextureGetTarget", referenced from:
       l2400 in GoogleMobileAds(flat-x86_64)   "_CVPixelBufferGetHeight", referenced from:
       l2397 in GoogleMobileAds(flat-x86_64)   "_CVPixelBufferGetWidth", referenced from:
       l2397 in GoogleMobileAds(flat-x86_64)   "_GLKMatrix4Identity", referenced from:
       l2392 in GoogleMobileAds(flat-x86_64)
       l2402 in GoogleMobileAds(flat-x86_64)   "_OBJC_CLASS_$_CBCentralManager", referenced from:
       objc-class-ref in GoogleMobileAds(flat-x86_64)   "_OBJC_CLASS_$_CBUUID", referenced from: …
Run Code Online (Sandbox Code Playgroud)

admob ios

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

如何删除"使用未声明的标识符:FIRDynamicLink"?

我们在此处遵循Firebase的动态说明,其中仅列出了一个需要"@import Firebase"的导入 - 但是当我们到达他们的行时

FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];

if (dynamicLink) { ...
Run Code Online (Sandbox Code Playgroud)

... XCode为FIRDynamicLink提供未声明的标识符.与"导入FirebaseAnalytics"等其他模块不同,似乎没有其他专用于动态链接的库.

pod内容为:pod"Firebase/DynamicLinks"

要编译它的诀窍是什么?

xcode objective-c ios firebase

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

如何将Facebook整合到iPhone App中

我知道这是一个经常被问到的问题; 但我的观点是:从iPhone App连接到FB的推荐或经过验证的方法是什么.

类型1:我在这里看到了教程.它使用AsiHttpRequest,Json库在FB墙上发布.

类型2:有一个教程在这里上Facebook网站本身,这是使用相同的图形API,但好像是用不同的API调用张贴在墙上,登录等.

以上两种哪种更好?Type-1使用外部库,但教程非常明确.Type-2似乎直接来自Facebook,但后来不知道教程是如何更新/过时的(没有指明日期).

iphone facebook-graph-api ios

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

MKdirections在两个给定点之间绘制路线

我正在使用教程制作示例应用程序.它使用填充了包含位置的JSon文件的表视图.在详细视图中,它使用Map并为表列表视图中选择的位置放置一个引脚.

我的问题是如何绘制当前用户位置之间的路线作为起点和"位置"位置作为目的地?

我现在在我的地图上有2个引脚:1)当前位置和2)目的地但我不知道如何将它们与路线相关联.使用这两个参数打开默认地图应用程序不是一个选项.

每个答案都要提前感谢.

mkmapview ios

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

在iOS中暂停和恢复计时器

这是一个常见的问题,但大多数答案似乎不起作用.我的应用程序中有一个计时器,我可以轻松启动并重新启动计时器.我试图暂停和恢复计时器,但现在恢复只从计时器继续计时器,该计时器大于我恢复它的计时器.这可能意味着它继续在后台计算.这是我的代码:

//Timer Variables
var startTime = NSTimeInterval()
var timer = NSTimer()
var isTiming = Bool()
var isPaused = Bool()

func updatedTimer() {

        let currentTime = NSDate.timeIntervalSinceReferenceDate()
        var elapsedTime: NSTimeInterval = currentTime - startTime
        let minutes = UInt8(elapsedTime / 60.0)

        elapsedTime -= (NSTimeInterval(minutes) * 60)
        let seconds = UInt8(elapsedTime)

        elapsedTime -= NSTimeInterval(seconds)

        let strMinutes = String(format: "%02d", minutes)
        let strSeconds = String(format: "%02d", seconds)

        workoutTime.text = "\(strMinutes) : \(strSeconds)"

    }


    @IBAction func startButtonTapped(sender: AnyObject) {

        if !timer.valid {

            timer = NSTimer.scheduledTimerWithTimeInterval(0.01, …
Run Code Online (Sandbox Code Playgroud)

timer ios swift

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