Click here to Skip to main content
11,573,408 members (60,047 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: iPhone Objective-C iOS
Hi everyone., i'm new to iphone application development.

i'm creating a application to send sms.

In my application i need to send sms on specified time.

I have a time picker to specify the time in UITextField.


-(void)sendInAppSMS
{
    NSLog(@"SendMessage");
 
    if([textFieldRounded.text isEqualToString:@""] || [textFieldRounded1.text isEqualToString:@""] || [textFieldRounded2.text isEqualToString:@""] || [textFieldRounded.text isEqualToString:@"(null)"] ||  [textFieldRounded1.text isEqualToString:@"(null)"] ||  [textFieldRounded1.text isEqualToString:@"(null)"] || [textFieldRounded.text isEqualToString:nil]  || [textFieldRounded1.text isEqualToString:nil]|| [textFieldRounded2.text isEqualToString:nil])
    {
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"SMS" message:@"Please Enter All Fields!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
        [alert show];
    }
    else
    {
        NSLog(@"Done");
        NSDateFormatter *SentTime = [[NSDateFormatter alloc] init];
        [SentTime setDateFormat:@"dd/MM/YYYY hh:mm aa"];
        NSDate *now1 = [NSDate date];
        NSString *Time1 = [SentTime stringFromDate:now1];
        NSLog(@"Time is :%@",Time1);
        NSString *Sentime=[NSString stringWithFormat:@"%@",textFieldRounded2.text];
 
        if([Sentime isEqualToString:Time1])
        {
            NSLog(@"Time Matching... can send msg now");
 
            MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
            if([MFMessageComposeViewController canSendText])
            {
 
                NSString *Message = [NSString stringWithFormat:@"%@, %@",textFieldRounded1.text,textFieldRounded2.text];
                NSLog(@"Message is %@", Message);
                controller.body = Message;
                controller.recipients = [NSArray arrayWithObjects:@"+919994442409" , nil];
                controller.messageComposeDelegate = self;
                [self presentModalViewController:controller animated:YES];
            }
 
        }
        else
        {
            NSLog(@"Send Message when time reach at %@",textFieldRounded2.text);
 
            //What code i should write here to store this message and to send on that specified time
        }
    }
}


if the time is equal to current time then send the sms nowitself (no need to store the messsage anywhere).

Other wise i need to send that sms , when current time becomes as that specified time. Until the time reach how to keep(store) the message and send on the time.



Posted 25-Nov-12 19:11pm
Edited 25-Nov-12 19:56pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

<Window.Resources>
        <Storyboard x:Key="Storyboard1" RepeatBehavior="Forever" AutoReverse="True">
            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="regularPolygon">
                <EasingPointKeyFrame KeyTime="0" Value="0.5,0.5">
                    <EasingPointKeyFrame.EasingFunction>
                        <BackEase EasingMode="EaseInOut"/>
                    </EasingPointKeyFrame.EasingFunction>
                </EasingPointKeyFrame>
                <EasingPointKeyFrame KeyTime="0:0:0.8" Value="0.5,0.5"/>
            </PointAnimationUsingKeyFrames>
            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="image">
                <EasingPointKeyFrame KeyTime="0:0:0.8" Value="0.5,0.5"/>
            </PointAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="image">
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="500"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="regularPolygon">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="500"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="Storyboard2">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="image2">
                <EasingDoubleKeyFrame KeyTime="0" Value="-30"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="image2">
                <EasingDoubleKeyFrame KeyTime="0" Value="-4"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="image2">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.583"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.15"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="2"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="image2">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.738"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1.54"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0.77"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.231"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="2"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
 
    </Window.Resources>
 

<Grid>
    <Canvas Name="cans" Margin="0,-10,0,10">
            <Image x:Name ="image" Margin="0,0,524,354" Source="taddy1.jpg" Stretch="Uniform" Width="100" >
            <Image.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Image.RenderTransform>
        </Image>
        <ed:RegularPolygon x:Name="regularPolygon" Fill="#FFF5F5F4" HorizontalAlignment="Left" Height="32" InnerRadius="0.47211" Margin="72,8,0,0" PointCount="5" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="14">
            <ed:RegularPolygon.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </ed:RegularPolygon.RenderTransform>
        </ed:RegularPolygon>
        <Image Name ="image1" Source="Arrow.jpg" Stretch="Uniform" Height="19" Canvas.Left="19" Canvas.Top="240">
 
         </Image>
<Slider Name="silde" Minimum="0" Maximum="550" SmallChange="5" ValueChanged="Slider_ValueChanged_1" Height="16" Width="604" Canvas.Top="416" Canvas.Left="10" />
<Image Name="imgball" Height="41" Canvas.Left="10" Source="ball3d.png" Stretch="Fill" Canvas.Top="370" Width="37"/>
 
    <Button Name="btntime" Canvas.Left="589" BorderThickness="0" Width="40" Height="40" Background="#FF629FC1"  IsEnabled="True" >
                <Button.Effect>
                    <DropShadowEffect ShadowDepth="10" BlurRadius="50"/>
                </Button.Effect>
 

            </Button>
    <Image x:Name="image2" Visibility="Collapsed" Height="61" Canvas.Left="264" Source="heart.jpg" Stretch="Fill" Canvas.Top="205" Width="96" RenderTransformOrigin="0.5,0.5">
        <Image.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Image.RenderTransform>
    </Image>
    <TextBlock Height="0" Canvas.Left="216" TextWrapping="Wrap" Text="TextBlock" Canvas.Top="202" Width="8"/>
 

 

 

        </Canvas>
</Grid>
</Window>
  Permalink  
Comments
Raajendran at 26-Nov-12 5:17am
   
Thank You,

can do this programatically ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100