开发者

How to develop a SMS client for iOS?

my original title was How to customize TTMessageController for SMS transmission?. I changed this now because I look for any possible solution and not only those with TTMessageController.

Well, I am working on an simple application in xcode4. The user should be able to send SMS from different SMS gateways.

The background logic is quite simple because everything is managed by executing some http requests on an rest api.

The hard thing for me now is to setup the UI and that is where I need help because I am new to iOS development. This is how I want it to be:

http://img222.imageshack.us/img222/3159/bhrfe.png

There should be a recipient picker to either do autosearch on contacts or to directly pick a contact from the contact list. Beside I want only one recipient. And there should be a text area.

I also want to have a label somewhere at the bottom to show the current char number.

Since I did not find those UI elements in xcode4 library I searched for something similar and I found the TTMessageController which gives me the view you see in the picture.

However plus button does not work and I am开发者_Go百科 not sure how to extend all this to do what I want.

I appreciate any idea on this.


For the + Button you can use the address book UI:

// This Code is taken from Apple's sample code QuickContacts
#import <AddressBookUI/AddressBookUI.h>

-(void)showPeoplePickerController {
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    picker.peoplePickerDelegate = self;
    // Display only a person's phone, email, and birthdate
    NSArray *displayedItems = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];


    picker.displayedProperties = displayedItems;
    // Show the picker 
    [self presentModalViewController:picker animated:YES];
    [picker release];   
}

The <ABPeoplePickerNavigationControllerDelegate> delegate include this methods:

– peoplePickerNavigationController:shouldContinueAfterSelectingPerson:
– peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:
– peoplePickerNavigationControllerDidCancel:

After selecting a person you can save his/her number in an array and in the text field (e.g. comma separated)

.

For the question if it will be approved here is the guideline:
https://developer.apple.com/appstore/resources/approval/guidelines.html

22.6 Apps that enable anonymous or prank phone calls or SMS/MMS messaging will be rejected


You can't use TTMessageController to send sms. The only possible way to send sms is to use MFMessageComposeViewController. Here's a tutorial on how to use it: http://blog.mugunthkumar.com/coding/iphone-tutorial-how-to-send-in-app-sms/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜