How to block incoming phone calls, text messages and email in Objective C - iphone

Is there any way to block incoming phone calls, text messages and email. Will appstore allows these kind of applications on appstore. Please help me if this is possible or not.

It is now possible from iOS 10 to block the unwanted calls
Checkout the CallKit framework
CallKit introduces app extensions that enable call blocking and caller identification. You can create an app extension that can associate a phone number with a name or tell the system when a number should be blocked.

Update: Never say never :) iOS 10 introduced this possiblity, see other answers.
Original:
NO, this is not possible with public API (and non-jailbroken devices)
And NO, Apple would never allow any app that disrupts the expected standard system behavior

Apple will never allow any third party application to do any illegal things without user's knowledge. This is the policy I think apple has applied to ensure his user's that their data are safe in their iphone. U can consider mails, calls, sms to be under those categories. There may be others which I might have missed.
Please refer this link for your knowledge

Only Apple can do that and unfortunately for you they plan to do otherwise.. :/

Even if it is called "smart", all in all your target device is a "phone" so the basic phone functionalities should not be ever blocked, and the phone manufacturers do not allow this for third party applications.

Rajan is correct you can block the incoming phone calls from iOS 10.
Create a Call Directory Extension , use the addBlockingEntry(withNextSequentialPhoneNumber:) method to pass the blocked numbers to the system.

Now it's end of 2018 and actually you can really do something with Apple's latest API.
As #Rajan stated, with CallKit API (iOS 10+) you can achieve call blocking and identification (i.e. show additional info on the incoming call screen for the caller's phone number).
You can also do SMS and Call Reporting (iOS 11+) as well, where you have access to the SMS content if the number is not in your Contacts.

Related

Store value of AlertView in iphone

HI,
I'm aware that accessing the SMS incoming isn't possible in the iPhone SDk but could i read the alertView that is active on the iPhone (ie. new SMS alert) and store its values into a variable? Obviously this would require backgrounding but in theory could this work?
As other stated, you cannot see the SMS message or associated alerts.
Not sure about iOS, but on other platforms (e.g. Java ME) it is possible to address an SMS to your application instead of the phone's "inbox" (default handler). This requires that you control the server sending the SMS message.
I imagine even if you could catch an SMS targeted at your iOS app, you wouldn't. Instead use Apple's Push Notification system.
I hesitate to type this in an iOS related question, but the Android OS makes it pretty trivial for an app to see SMS messages. You can even be woken up as they arrive. So, if you just want to test out some idea you have, consider that.
No. You can access your own alerts but not those from other applications.
Unfortunately, you cannot access other application's data, be it in background or not.

Can we fetch the call details of an iPhone?

Can we fetch the call details like dialed numbers, missed calls of an iPhone?
UPDATE
Can we do it in jail broken phones for CYDIA store?
Yes, you can do it for jailbroken device.
The call history is stored in call_history.db.
No - Apple simply don't provide an API to do this.
No, no information about phone calls is available, nor SMS messages.
iOS apps are sandboxed to prevent developers from doing nasty things like sending that data back to their servers. It limits some potentially cool apps, but it also protects privacy.
Yes,You can't do with non-Jail Broken iphones. If you want to do that,you must have a jail broken iphone. API is not providing any private API to access their APplication SANDBOx.Apple will never provide due to security.

Phone development: interact with the call?

Today, the focus of a cell phone's capabilities is drifting away from plain making a phone call.
And somehow, this shows in the API's too. Therefor I'm wondering: if I want to write an app that e.g. pitches up, records, scrambles... an incoming call - you know, the voice on the other side -, what aspect of the API should I use?
I looked into Android, into Windows Phone, iPhone... (briefly), but had no luck. Is this just unintended usage?
This is also not possible with Windows Phone 7. There were, however, API methods for interacting with incoming and outgoing calls and texts in Windows Mobile.
The reason this is not possible in Windows Phone 7 comes down to a deliberate decision around data security and the aim that apps on the phone shouldn't be able to do something without the user specifically knowing about it. This prevents, amongst other things, malicious apps having information about or access to potentially sensitive data.
This is not possible in Android, except maybe via firmware modifications.
There’s no way to do that with the iPhone SDK. It may be possible through jailbreaking, but I’m not familiar enough with it to speak on it.
Given the limited accessibility of in-call audio but ready access to microphone/speaker and data on current smartphones, would probably be easiest to do this as part of a VOIP calling application.

iPhone answering machine

Is it possible to create an iPhone application to answer incoming voice calls and play audio files back to the caller? If yes, before answering the call, is it possible to determine the caller id?
Thanks!
This is not possible using the SDK. You can most likely do it with a jailbroken app.
iPhone applications (non-jailbreak apps, at least) cannot intercept phone calls. When a phone call is initiated, your app is paused and cannot execute any commands.
Essentially, count on never being able to prevent basic functionality of the iPhone. You can't override texting behaviour, Mail.app behaviour, Safari behavior, etc. because Apple wants the user experience to be consistent (not to mention security issues in allowing an app to answer calls on someone's behalf).

Can an iPhone app block phone calls?

Is it possible to write an application that will block incoming and outcoming phone calls? Or is the iPhone locked down too much? Thanks!
EDIT: See Rajan Maheshwari's answer below. CallKit now provides this. Even things that seemed they would never change, can change eventually.
Anything that modifies a user's ability to make or receive phone calls is going to run afoul of Apple's basic approach to third-party apps. There are a lot of things that are questionable and you might get away with. Blocking calls is clearly forbidden.
It is now possible to detect and block unwanted phone calls from iOS 10 and above.
See the CallKit framework
The CallKit framework (CallKit.framework) lets VoIP apps integrate with the iPhone UI and give users a great experience. Use this framework to let users view and answer incoming VoIP calls on the lock screen and manage contacts from VoIP calls in the Phone app’s Favorites and Recents views.
CallKit also introduces app extensions that enable call blocking and caller identification. You can create an app extension that can associate a phone number with a name or tell the system when a number should be blocked.
A number of events will potentially interrupt an application - incoming call, SMS message or calendar alert. If the user ignores the interruption your application will continue running. If not, it will terminate.
See Apple docs for more details.
It is possible in iOS 10.
Here's how to do it ->
1.Create a call directory extension
2.Block the incoming call ->
class CustomCallDirectoryProvider: CXCallDirectoryProvider {
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
let blockedPhoneNumbers: [CXCallDirectoryPhoneNumber] = [ phone Numbers here with country code! ]
for phoneNumber in blockedPhoneNumbers.sorted(by: <) {
context.addBlockingEntry(withNextSequentialPhoneNumber: phoneNumber)
}
context.completeRequest()
}
}
Note:
If you are using callKit to receive incoming calls then there is no need to manually block other calls.
Link -> https://developer.apple.com/reference/callkit
An app has not access to the phone feature, and has no way to block a call.
The alternative is to wait for Apple to offer that feature in the future.
In the meantime, you can
Ask your provider - some providers do that
Create a custom ring tone (silent) to be associated to some number (no ring).