这是我要问的新事物,因为我没有得到任何答案.
我正在使用亚马逊SNS推送发送推送到我的注册设备,一切正常,我可以在我的应用程序首先启动注册设备,可以发送推送等等.我面临的问题是,我想打开一个特定的页面当我通过推动打开我的应用程序.我想用有效载荷发送一些额外的参数,但我无法做到这一点.
我试过这个链接: - http://docs.aws.amazon.com/sns/latest/api/API_Publish.html
我们只有一个键,即"消息",据我所知,我们可以在其中传递有效载荷.
我想通过这样的有效载荷: -
{
aps = {
alert = "My Push text Msg";
};
"id" = "123",
"s" = "section"
}
Run Code Online (Sandbox Code Playgroud)
或任何其他格式是好的,我只想传递2-3个值和有效负载,以便我可以在我的应用程序中使用它们.
我用来发送推送的代码是: -
// Load the AWS SDK for PHP
if($_REQUEST)
{
$title=$_REQUEST["push_text"];
if($title!="")
{
require 'aws-sdk.phar';
// Create a new Amazon SNS client
$sns = Aws\Sns\SnsClient::factory(array(
'key' => '...',
'secret' => '...',
'region' => 'us-east-1'
));
// Get and display the platform applications
//print("List All Platform Applications:\n");
$Model1 = $sns->listPlatformApplications();
print("\n</br></br>");*/
// Get …
Run Code Online (Sandbox Code Playgroud) 其实我正在制作一个报警应用程序.在那时我设置时间UILocalNotification事件发生在那时,它调用AppDelegate类的方法,即didReceiveNotifications方法.在这个方法中,我编写了一个代码来调用SetViewController(showReminder方法)的方法,现在在这个方法中,我希望它应该显示一个NewViewController,即TimeViewController,因为我必须在Alarm Invokes时显示动画.
我需要这个当闹钟调用时我已经设置了一个动作表来显示但是我也想显示动画.动作表出现在所有视图中但是动画可以仅显示在特定视图中,这就是为什么我需要显示不同的ViewController.
这是我正在尝试的代码: - 我已经尝试了这些也像PresentModalViewController,dismissModalViewController,AddSubview,删除superView ...但结果是否定的:(我该怎么办...?
几乎整个代码: -
AppDelegate类: -
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
if (notification){
NSLog(@"In did Notification");
NSString *reminderText = [notification.userInfo objectForKey:kRemindMeNotificationDataKey];
[viewController showReminder:reminderText];
application.applicationIconBadgeNumber = 0;
}
}
Run Code Online (Sandbox Code Playgroud)
setViewController.h: -
@interface SetAlarmViewController : UIViewController <UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,UIActionSheetDelegate>{
IBOutlet UITableView *tableview;
IBOutlet UIDatePicker *datePicker;
IBOutlet UITextField *eventText;
TPKeyboardAvoidingScrollView *scrollView;
IBOutlet UINavigationBar *titleBar;
IBOutlet UIButton *setAlarmButton;
AVAudioPlayer *player;
int index;
The420DudeAppDelegate *appDelegate;
TimeViewController *viewController;
IBOutlet UIImageView *animatedImages;
NSMutableArray *imageArray;
AVPlayerItem *player1,*player3;
AVPlayerItem *player2,*player4;
AVQueuePlayer *queuePlayer;
}
@property (nonatomic, …
Run Code Online (Sandbox Code Playgroud)