How to get camera and microphone access in WKWebView cocoa?












-2















In my cocoa application I am using WKWebView and everything works fine, but when I try to make an Audio or Video call, it is not happening, as I don't have the permissions for camera and microphone. So, how can I get access to both. I've injected javascript is there any way so that we can allow Microphone and camera by default using script?



i've tried allow(tried to resolve the promise) using below code, but still i am unable to access microphone. As this popup will not show in WKWebView so how do i take permission.



this



  async function wrapperFunc() {
try {
alert("resolved 1");
let r1 = await someFunc();
let r2 = await someFunc2(r1);
// now process r2
return someValue; // this will be resolved value of the returned promise
} catch(e) {
throw e; // let caller know the promise rejected with this reason
}
}

wrapperFunc().then(result => {
// got final result
alert("resolved");
}).catch(err => {
// got error
});


this is what i am getting



Any suggestions?



Thanks in Advance !!










share|improve this question




















  • 1





    is there any way so that we can allow Microphone and camera by default using script? Seriously? Do you realize how much of a vulnerability that would be?

    – Desdenova
    Nov 29 '18 at 11:03











  • yes i know, but is there any other possibility that you can share.

    – iosdev
    Nov 29 '18 at 11:12
















-2















In my cocoa application I am using WKWebView and everything works fine, but when I try to make an Audio or Video call, it is not happening, as I don't have the permissions for camera and microphone. So, how can I get access to both. I've injected javascript is there any way so that we can allow Microphone and camera by default using script?



i've tried allow(tried to resolve the promise) using below code, but still i am unable to access microphone. As this popup will not show in WKWebView so how do i take permission.



this



  async function wrapperFunc() {
try {
alert("resolved 1");
let r1 = await someFunc();
let r2 = await someFunc2(r1);
// now process r2
return someValue; // this will be resolved value of the returned promise
} catch(e) {
throw e; // let caller know the promise rejected with this reason
}
}

wrapperFunc().then(result => {
// got final result
alert("resolved");
}).catch(err => {
// got error
});


this is what i am getting



Any suggestions?



Thanks in Advance !!










share|improve this question




















  • 1





    is there any way so that we can allow Microphone and camera by default using script? Seriously? Do you realize how much of a vulnerability that would be?

    – Desdenova
    Nov 29 '18 at 11:03











  • yes i know, but is there any other possibility that you can share.

    – iosdev
    Nov 29 '18 at 11:12














-2












-2








-2








In my cocoa application I am using WKWebView and everything works fine, but when I try to make an Audio or Video call, it is not happening, as I don't have the permissions for camera and microphone. So, how can I get access to both. I've injected javascript is there any way so that we can allow Microphone and camera by default using script?



i've tried allow(tried to resolve the promise) using below code, but still i am unable to access microphone. As this popup will not show in WKWebView so how do i take permission.



this



  async function wrapperFunc() {
try {
alert("resolved 1");
let r1 = await someFunc();
let r2 = await someFunc2(r1);
// now process r2
return someValue; // this will be resolved value of the returned promise
} catch(e) {
throw e; // let caller know the promise rejected with this reason
}
}

wrapperFunc().then(result => {
// got final result
alert("resolved");
}).catch(err => {
// got error
});


this is what i am getting



Any suggestions?



Thanks in Advance !!










share|improve this question
















In my cocoa application I am using WKWebView and everything works fine, but when I try to make an Audio or Video call, it is not happening, as I don't have the permissions for camera and microphone. So, how can I get access to both. I've injected javascript is there any way so that we can allow Microphone and camera by default using script?



i've tried allow(tried to resolve the promise) using below code, but still i am unable to access microphone. As this popup will not show in WKWebView so how do i take permission.



this



  async function wrapperFunc() {
try {
alert("resolved 1");
let r1 = await someFunc();
let r2 = await someFunc2(r1);
// now process r2
return someValue; // this will be resolved value of the returned promise
} catch(e) {
throw e; // let caller know the promise rejected with this reason
}
}

wrapperFunc().then(result => {
// got final result
alert("resolved");
}).catch(err => {
// got error
});


this is what i am getting



Any suggestions?



Thanks in Advance !!







objective-c macos cocoa wkwebview microphone






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 30 '18 at 5:05







iosdev

















asked Nov 28 '18 at 6:37









iosdeviosdev

498




498








  • 1





    is there any way so that we can allow Microphone and camera by default using script? Seriously? Do you realize how much of a vulnerability that would be?

    – Desdenova
    Nov 29 '18 at 11:03











  • yes i know, but is there any other possibility that you can share.

    – iosdev
    Nov 29 '18 at 11:12














  • 1





    is there any way so that we can allow Microphone and camera by default using script? Seriously? Do you realize how much of a vulnerability that would be?

    – Desdenova
    Nov 29 '18 at 11:03











  • yes i know, but is there any other possibility that you can share.

    – iosdev
    Nov 29 '18 at 11:12








1




1





is there any way so that we can allow Microphone and camera by default using script? Seriously? Do you realize how much of a vulnerability that would be?

– Desdenova
Nov 29 '18 at 11:03





is there any way so that we can allow Microphone and camera by default using script? Seriously? Do you realize how much of a vulnerability that would be?

– Desdenova
Nov 29 '18 at 11:03













yes i know, but is there any other possibility that you can share.

– iosdev
Nov 29 '18 at 11:12





yes i know, but is there any other possibility that you can share.

– iosdev
Nov 29 '18 at 11:12












1 Answer
1






active

oldest

votes


















1














Here is the steps you need to follow :




  • First add the NSCameraUsageDescription and NSMicrophoneUsageDescription permissions to the Info.plist for your project


  • Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView.



Let say for ex:



(function() {
if (!window.navigator) window.navigator = {};
window.navigator.getUserMedia = function() {
webkit.messageHandlers.callbackHandler.postMessage(arguments);
}
})();



  • In the WKWebView inject the script at the document start:



let contentController = WKUserContentController();
contentController.add(self, name: "callbackHandler")



let script = try! String(contentsOf: Bundle.main.url(forResource: "WebRTC", withExtension: "js")!, encoding: String.Encoding.utf8)
contentController.addUserScript(WKUserScript(source: script, injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: true))



let config = WKWebViewConfiguration()
config.userContentController = contentController



webView = WKWebView(frame: CGRect.zero, configuration: config)





  • Now Add this :



class ViewController: UIViewController, WKUIDelegate,
WKNavigationDelegate, WKScriptMessageHandler {



var webView: WKWebView!
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name == "callbackHandler" {
print(message.body)
// make native calls to the WebRTC framework here
}
} }




  • If success or failure callbacks need to be performed back in JavaScript-land, evaluate the function call directly within the WKWebView:



webView.evaluateJavaScript("callback({id: (id), status: 'success',
args: ...})", completionHandler: nil)




These callbacks need to be stored in a hash in the JavaScript before calling postMessage, then the hash key must be sent to the WKWebView. This is the commandId in the plugins.



int exec_id = 0;
function exec(success, failure, ...) {
if (typeof success == 'function' || typeof failure == 'function') {
exec_id++;
exec_callbacks[exec_id] = { success: success, failure: failure };
var commandId = exec_id;
}
webkit.messageHandlers.callbackHandler.postMessage({id: commandId, args: ...})
}

function callback(opts) {
if (opts.status == "success") {
if (typeof exec_callbacks[opts.id].success == 'function') exec_callbacks[opts.id].success(opts.args);
} else {
if (typeof exec_callbacks[opts.id].failure == 'function') exec_callbacks[opts.id].failure(opts.args);
}
if (!opts.keepalive) delete exec_callbacks[opts.id];
}


Hope this helps.






share|improve this answer
























  • can give exact link of WebRTC.js and how will it ask for permission?

    – iosdev
    Nov 29 '18 at 7:08











  • Need to replace your js file there

    – Mayur
    Nov 29 '18 at 7:11











  • i found this so exactly which js i need to add in my app.

    – iosdev
    Nov 29 '18 at 7:15











  • have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

    – Mayur
    Nov 29 '18 at 7:16











  • hey i have my js file testapp.js which i have already injected to my code.

    – iosdev
    Nov 29 '18 at 7:20











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53513521%2fhow-to-get-camera-and-microphone-access-in-wkwebview-cocoa%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Here is the steps you need to follow :




  • First add the NSCameraUsageDescription and NSMicrophoneUsageDescription permissions to the Info.plist for your project


  • Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView.



Let say for ex:



(function() {
if (!window.navigator) window.navigator = {};
window.navigator.getUserMedia = function() {
webkit.messageHandlers.callbackHandler.postMessage(arguments);
}
})();



  • In the WKWebView inject the script at the document start:



let contentController = WKUserContentController();
contentController.add(self, name: "callbackHandler")



let script = try! String(contentsOf: Bundle.main.url(forResource: "WebRTC", withExtension: "js")!, encoding: String.Encoding.utf8)
contentController.addUserScript(WKUserScript(source: script, injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: true))



let config = WKWebViewConfiguration()
config.userContentController = contentController



webView = WKWebView(frame: CGRect.zero, configuration: config)





  • Now Add this :



class ViewController: UIViewController, WKUIDelegate,
WKNavigationDelegate, WKScriptMessageHandler {



var webView: WKWebView!
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name == "callbackHandler" {
print(message.body)
// make native calls to the WebRTC framework here
}
} }




  • If success or failure callbacks need to be performed back in JavaScript-land, evaluate the function call directly within the WKWebView:



webView.evaluateJavaScript("callback({id: (id), status: 'success',
args: ...})", completionHandler: nil)




These callbacks need to be stored in a hash in the JavaScript before calling postMessage, then the hash key must be sent to the WKWebView. This is the commandId in the plugins.



int exec_id = 0;
function exec(success, failure, ...) {
if (typeof success == 'function' || typeof failure == 'function') {
exec_id++;
exec_callbacks[exec_id] = { success: success, failure: failure };
var commandId = exec_id;
}
webkit.messageHandlers.callbackHandler.postMessage({id: commandId, args: ...})
}

function callback(opts) {
if (opts.status == "success") {
if (typeof exec_callbacks[opts.id].success == 'function') exec_callbacks[opts.id].success(opts.args);
} else {
if (typeof exec_callbacks[opts.id].failure == 'function') exec_callbacks[opts.id].failure(opts.args);
}
if (!opts.keepalive) delete exec_callbacks[opts.id];
}


Hope this helps.






share|improve this answer
























  • can give exact link of WebRTC.js and how will it ask for permission?

    – iosdev
    Nov 29 '18 at 7:08











  • Need to replace your js file there

    – Mayur
    Nov 29 '18 at 7:11











  • i found this so exactly which js i need to add in my app.

    – iosdev
    Nov 29 '18 at 7:15











  • have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

    – Mayur
    Nov 29 '18 at 7:16











  • hey i have my js file testapp.js which i have already injected to my code.

    – iosdev
    Nov 29 '18 at 7:20
















1














Here is the steps you need to follow :




  • First add the NSCameraUsageDescription and NSMicrophoneUsageDescription permissions to the Info.plist for your project


  • Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView.



Let say for ex:



(function() {
if (!window.navigator) window.navigator = {};
window.navigator.getUserMedia = function() {
webkit.messageHandlers.callbackHandler.postMessage(arguments);
}
})();



  • In the WKWebView inject the script at the document start:



let contentController = WKUserContentController();
contentController.add(self, name: "callbackHandler")



let script = try! String(contentsOf: Bundle.main.url(forResource: "WebRTC", withExtension: "js")!, encoding: String.Encoding.utf8)
contentController.addUserScript(WKUserScript(source: script, injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: true))



let config = WKWebViewConfiguration()
config.userContentController = contentController



webView = WKWebView(frame: CGRect.zero, configuration: config)





  • Now Add this :



class ViewController: UIViewController, WKUIDelegate,
WKNavigationDelegate, WKScriptMessageHandler {



var webView: WKWebView!
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name == "callbackHandler" {
print(message.body)
// make native calls to the WebRTC framework here
}
} }




  • If success or failure callbacks need to be performed back in JavaScript-land, evaluate the function call directly within the WKWebView:



webView.evaluateJavaScript("callback({id: (id), status: 'success',
args: ...})", completionHandler: nil)




These callbacks need to be stored in a hash in the JavaScript before calling postMessage, then the hash key must be sent to the WKWebView. This is the commandId in the plugins.



int exec_id = 0;
function exec(success, failure, ...) {
if (typeof success == 'function' || typeof failure == 'function') {
exec_id++;
exec_callbacks[exec_id] = { success: success, failure: failure };
var commandId = exec_id;
}
webkit.messageHandlers.callbackHandler.postMessage({id: commandId, args: ...})
}

function callback(opts) {
if (opts.status == "success") {
if (typeof exec_callbacks[opts.id].success == 'function') exec_callbacks[opts.id].success(opts.args);
} else {
if (typeof exec_callbacks[opts.id].failure == 'function') exec_callbacks[opts.id].failure(opts.args);
}
if (!opts.keepalive) delete exec_callbacks[opts.id];
}


Hope this helps.






share|improve this answer
























  • can give exact link of WebRTC.js and how will it ask for permission?

    – iosdev
    Nov 29 '18 at 7:08











  • Need to replace your js file there

    – Mayur
    Nov 29 '18 at 7:11











  • i found this so exactly which js i need to add in my app.

    – iosdev
    Nov 29 '18 at 7:15











  • have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

    – Mayur
    Nov 29 '18 at 7:16











  • hey i have my js file testapp.js which i have already injected to my code.

    – iosdev
    Nov 29 '18 at 7:20














1












1








1







Here is the steps you need to follow :




  • First add the NSCameraUsageDescription and NSMicrophoneUsageDescription permissions to the Info.plist for your project


  • Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView.



Let say for ex:



(function() {
if (!window.navigator) window.navigator = {};
window.navigator.getUserMedia = function() {
webkit.messageHandlers.callbackHandler.postMessage(arguments);
}
})();



  • In the WKWebView inject the script at the document start:



let contentController = WKUserContentController();
contentController.add(self, name: "callbackHandler")



let script = try! String(contentsOf: Bundle.main.url(forResource: "WebRTC", withExtension: "js")!, encoding: String.Encoding.utf8)
contentController.addUserScript(WKUserScript(source: script, injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: true))



let config = WKWebViewConfiguration()
config.userContentController = contentController



webView = WKWebView(frame: CGRect.zero, configuration: config)





  • Now Add this :



class ViewController: UIViewController, WKUIDelegate,
WKNavigationDelegate, WKScriptMessageHandler {



var webView: WKWebView!
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name == "callbackHandler" {
print(message.body)
// make native calls to the WebRTC framework here
}
} }




  • If success or failure callbacks need to be performed back in JavaScript-land, evaluate the function call directly within the WKWebView:



webView.evaluateJavaScript("callback({id: (id), status: 'success',
args: ...})", completionHandler: nil)




These callbacks need to be stored in a hash in the JavaScript before calling postMessage, then the hash key must be sent to the WKWebView. This is the commandId in the plugins.



int exec_id = 0;
function exec(success, failure, ...) {
if (typeof success == 'function' || typeof failure == 'function') {
exec_id++;
exec_callbacks[exec_id] = { success: success, failure: failure };
var commandId = exec_id;
}
webkit.messageHandlers.callbackHandler.postMessage({id: commandId, args: ...})
}

function callback(opts) {
if (opts.status == "success") {
if (typeof exec_callbacks[opts.id].success == 'function') exec_callbacks[opts.id].success(opts.args);
} else {
if (typeof exec_callbacks[opts.id].failure == 'function') exec_callbacks[opts.id].failure(opts.args);
}
if (!opts.keepalive) delete exec_callbacks[opts.id];
}


Hope this helps.






share|improve this answer













Here is the steps you need to follow :




  • First add the NSCameraUsageDescription and NSMicrophoneUsageDescription permissions to the Info.plist for your project


  • Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView.



Let say for ex:



(function() {
if (!window.navigator) window.navigator = {};
window.navigator.getUserMedia = function() {
webkit.messageHandlers.callbackHandler.postMessage(arguments);
}
})();



  • In the WKWebView inject the script at the document start:



let contentController = WKUserContentController();
contentController.add(self, name: "callbackHandler")



let script = try! String(contentsOf: Bundle.main.url(forResource: "WebRTC", withExtension: "js")!, encoding: String.Encoding.utf8)
contentController.addUserScript(WKUserScript(source: script, injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: true))



let config = WKWebViewConfiguration()
config.userContentController = contentController



webView = WKWebView(frame: CGRect.zero, configuration: config)





  • Now Add this :



class ViewController: UIViewController, WKUIDelegate,
WKNavigationDelegate, WKScriptMessageHandler {



var webView: WKWebView!
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name == "callbackHandler" {
print(message.body)
// make native calls to the WebRTC framework here
}
} }




  • If success or failure callbacks need to be performed back in JavaScript-land, evaluate the function call directly within the WKWebView:



webView.evaluateJavaScript("callback({id: (id), status: 'success',
args: ...})", completionHandler: nil)




These callbacks need to be stored in a hash in the JavaScript before calling postMessage, then the hash key must be sent to the WKWebView. This is the commandId in the plugins.



int exec_id = 0;
function exec(success, failure, ...) {
if (typeof success == 'function' || typeof failure == 'function') {
exec_id++;
exec_callbacks[exec_id] = { success: success, failure: failure };
var commandId = exec_id;
}
webkit.messageHandlers.callbackHandler.postMessage({id: commandId, args: ...})
}

function callback(opts) {
if (opts.status == "success") {
if (typeof exec_callbacks[opts.id].success == 'function') exec_callbacks[opts.id].success(opts.args);
} else {
if (typeof exec_callbacks[opts.id].failure == 'function') exec_callbacks[opts.id].failure(opts.args);
}
if (!opts.keepalive) delete exec_callbacks[opts.id];
}


Hope this helps.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 28 '18 at 9:00









MayurMayur

3,57762853




3,57762853













  • can give exact link of WebRTC.js and how will it ask for permission?

    – iosdev
    Nov 29 '18 at 7:08











  • Need to replace your js file there

    – Mayur
    Nov 29 '18 at 7:11











  • i found this so exactly which js i need to add in my app.

    – iosdev
    Nov 29 '18 at 7:15











  • have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

    – Mayur
    Nov 29 '18 at 7:16











  • hey i have my js file testapp.js which i have already injected to my code.

    – iosdev
    Nov 29 '18 at 7:20



















  • can give exact link of WebRTC.js and how will it ask for permission?

    – iosdev
    Nov 29 '18 at 7:08











  • Need to replace your js file there

    – Mayur
    Nov 29 '18 at 7:11











  • i found this so exactly which js i need to add in my app.

    – iosdev
    Nov 29 '18 at 7:15











  • have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

    – Mayur
    Nov 29 '18 at 7:16











  • hey i have my js file testapp.js which i have already injected to my code.

    – iosdev
    Nov 29 '18 at 7:20

















can give exact link of WebRTC.js and how will it ask for permission?

– iosdev
Nov 29 '18 at 7:08





can give exact link of WebRTC.js and how will it ask for permission?

– iosdev
Nov 29 '18 at 7:08













Need to replace your js file there

– Mayur
Nov 29 '18 at 7:11





Need to replace your js file there

– Mayur
Nov 29 '18 at 7:11













i found this so exactly which js i need to add in my app.

– iosdev
Nov 29 '18 at 7:15





i found this so exactly which js i need to add in my app.

– iosdev
Nov 29 '18 at 7:15













have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

– Mayur
Nov 29 '18 at 7:16





have you did 2nd step ? "Now Add JS file (WebRTC.js) that defines various WebRTC classes, functions & passes the calls to the WKWebView. "

– Mayur
Nov 29 '18 at 7:16













hey i have my js file testapp.js which i have already injected to my code.

– iosdev
Nov 29 '18 at 7:20





hey i have my js file testapp.js which i have already injected to my code.

– iosdev
Nov 29 '18 at 7:20




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53513521%2fhow-to-get-camera-and-microphone-access-in-wkwebview-cocoa%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks