开发者

send sms by pre schedule sms in sqlite table

I am working on SMS pre schedule app in iphone where I am using sqlite table to store date time,phone no,message.

I want to send sms by the time that it saved in sqlite table u开发者_StackOverflow社区sing pre schedule time. Please help me out by suggest me code to send sms using NStimer.

and also upadte timer to the next nearest time in sqlite table automatically.


You can get time difference from stored date and current date while saving details in DB and put NSTimer according to that. i.e. if you are saving timer which should fire after 5 minutes (5*60=300 Seconds) you can have that amount and create NSTimer accordingly like. Here in userInfo i have used nil but you can send required data like smstext/recipient by making custom object. For that refer NSTImer documentation.

[NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(sendSMS:) userInfo:nil repeats:NO];

Though I won't suggest you to go this way as For many (In terms of big qty) SMS many NSTimers would be allocated and may lead to some memory related problems.

SMS can be send using MFMessageComposeViewController class. You can view MFMessageComposeViewController documentation.

Now main point, you can present SMS screen by populating predefined values like recipients, body of SMS. But User have to send message manually, he has two options cancel/send. To track user's action you can set delegate your controller to that.

This is not complete answer to your question but may have you some progress.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜