应用程序在后台时无法接听电话

时间:2016-11-17 07:27:05

标签: ios background voip pjsip

我正在使用此代码为我的VOIP应用程序启用后台模式。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<section id="jdom">
		<h1>Murach's JavaScript and DOM Scripting</h1>
		<h2>Book description</h2>
		<div class="section">
            <p>You can read other JavaScript books from start to finish and still not
            know how to develop dynamic websites like you want to.</p>
			<div class="hide more-section">
				<p>But now, you can go from JavaScript beginner to DOM scripting expert in a 
				single book! Fast-paced, professional, and packed with expert practices, our 
				new JavaScript book.</p>
			</div>
			<a href="#">Show more</a>
        </div>
		<h2>About the author</h2>
		<div class="section">
            <p>Ray Harris is an expert JavaScript programmer. That will be obvious to you 
            as soon as you review the 20 complete applications that he presents in this 
            book.</p>
			<div class="hide more-section">
				<p>Ray Harris is much more than a JavaScript programmer.</p>
				<p>So when Ray said he wanted to write for us, it didn't take us long to hire him.</p>
			</div>
			<a href="#">Show more</a>
        </div>
        
			
		<h2>Who this book is for</h2>
		<div class="section">
            <p>Due to our unique presentation methods and this book's modular organization,
			this is the right book for any web developer who wants to use JavaScript effectively.</p>
			<div class="hide more-section"> 
				<p>Here's just a partial list of who can use this book:</p>
				<ul>
					<li>Web developers who know HTML and CSS and are ready to master JavaScript.</li> 
					<li>Web developers who program in ASP.NET, JSP, or PHP on the server side and 
					now want to master client-side coding.</li>
					<li>Web developers who have already read 3 or 4 JavaScript or DOM scripting books 
					but still don't know how to do the type of DOM scripting that's required in 
					real-world applications</li>
				</ul>
			</div>
			<a href="#">Show more</a>
		</div>
	</section>

KeepAlive的代码是:

- (void)applicationDidEnterBackground:(UIApplication *)application{

[NSTimer timerWithTimeInterval:60.0 target:self selector:@selector(sipRegisterEveryTime) userInfo:nil repeats:YES];
[self performSelectorOnMainThread:@selector(keepAlive) withObject:nil waitUntilDone:YES];
[application setKeepAliveTimeout:KEEP_ALIVE_INTERVAL handler:
 ^{
     [self performSelectorOnMainThread:@selector(keepAlive) withObject:nil waitUntilDone:YES];
 }];}

但是,当我的应用程序处于后台时,如果有任何VOIP呼叫到达,我的应用程序无法唤醒。 info.plist通过在“必需的后台模式”中设置“App提供IP语音服务”,为VOIP后台启用了设置.VOIP的内部功能设置已完成。我还需要做些什么吗?我在我的VOIP应用程序中使用PJSIP库。

1 个答案:

答案 0 :(得分:0)

尝试将这些字符串添加到info.plist文件

enter image description here

并参考此StackOverFlow Answer