使用Amazon SNS从iOS发送推送通知

时间:2016-12-01 15:09:22

标签: ios objective-c amazon-web-services amazon-sns

我将Amazon SNS和iOS App设置为通过SNS控制台发送推送通知并在iOS中接收。它工作正常。

现在,我正在尝试将推送通知从设备发送到另一台设备,但我收到以下错误:

  

- [AWSServiceInfo initWithInfoDictionary:checkRegion:] |无法从 <?php namespace Drupal\custom_field\Plugin\Field\FieldType; use Drupal\Core\Field\FieldItemBase; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\TypedData\DataDefinition; /** * Plugin implementation of the 'Program' field type. * * @FieldType( * id = "program", * label = @Translation("Programmation"), * description = @Translation("Stores a Program n date string in various format"), * default_widget = "program_default", * default_formatter = "program_default", * ) */ class ProgramItem extends FieldItemBase implements FieldItemInterface { public static function schema(FieldStorageDefinitionInterface $field_definition) { return array( 'columns' => array( 'date' => array( 'description' => 'Programmation du jour.(date)', 'type' => 'varchar', 'length' => 255, 'size' => 'normal', ), 'programmation' => array( 'description' => 'Programmation. (Concerts)', 'type' => 'varchar', 'length' => 5000, 'size' => 'normal', ), ), ); } public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { $properties['date'] = DataDefinition::create('string') ->setLabel(t('Date du jour')); $properties['programmation'] = DataDefinition::create('string') ->setLabel(t('Programmation du jour')); return $properties; } public function isEmpty() { $value = $this->get('date')->getValue(); return empty($value); } public static function mainPropertyName() { return 'date'; } } <?php namespace Drupal\custom_field\Plugin\Field\FieldWidget; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; use Drupal\Core\Field\WidgetBaseInterface; use Drupal\Core\Form\FormStateInterface; /** * Plugin implementation of the 'Program' widget. * * @FieldWidget( * id = "program_default", * label = @Translation("Programmation"), * field_types = { * "program" * } * ) */ class ProgramWidget extends WidgetBase implements WidgetBaseInterface { /** * @param FieldItemListInterface $items * @param int $delta * @param array $element * @param array $form * @param FormStateInterface $form_state * @return array */ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element['date'] = array( '#type' => 'textfield', '#title' => $this->t('Date'), '#placeholder' => $this->getSetting('placeholder_date'), '#default_value' => isset($items[$delta]->date) ? $items[$delta]->date : NULL, '#required' => $element['#required'], ); $element['programmation'] = array( '#type' => 'text_format', '#title' => $this->t('Programmation'), '#placeholder' => $this->getSetting('placeholder_programmation'), '#default_value' => isset($items[$delta]->programmation) ? $items[$delta]->programmation : NULL, '#format' => 'full_html', ); $element['field_widget_display']['#access'] = true; $element['field_widget_display_settings']['#access'] = true; die('ProgramWidget'); return $element; } } 读取凭据提供程序配置。请检查   如果您要提供SDK配置值,则为Info.plist   通过Info.plist

我的代码是发送推送通知

Info.plist

我不知道我错过了什么。

1 个答案:

答案 0 :(得分:1)

根据AWSInfo.m here的调试日志,如果您尚未配置defaultCognitoCredentialsProvider

,则会出现此错误

他们会检查

_cognitoCredentialsProvider = [AWSInfo defaultAWSInfo].defaultCognitoCredentialsProvider;

如果他们发现_cognitoCredentialsProvider为零,那么您将收到此错误。

正确配置defaultCognitoCredentialsProvider