# Configurando badges para Flutter

1. Abra seu projeto iOS localizado em **your_project/ios/Runner.xcworkspace** e crie uma **NotificationServiceExtension**:

<img src="/flutter-setting-up-badges-for-flutter-1.webp" alt=""/>

<img src="/flutter-setting-up-badges-for-flutter-2.webp" alt=""/>

2. Abra o Podfile (localizado em **your_project/ios/Podfile**) e adicione a dependência **PushwooshXCFramework** para o NotificationServiceExtensionTarget:

```
target ‘NotificationService’ do
  pod ‘PushwooshXCFramework’, ‘>=6.5.0’
end
```

<Aside type="note">
Você pode colocar essas linhas após `target ‘Runner’ do` como no exemplo abaixo:

```bash title="Exemplo de Podfile"
target ‘Runner’ do
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
target ‘NotificationService’ do
  pod ‘PushwooshXCFramework’, ‘>=6.5.0’
end
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
```
</Aside>

3. Instale os pods via Terminal:

```
cd ios && pod install
```

4. Feche e reabra seu projeto Xcode.

<Aside type="caution">
Certifique-se de abrir o projeto **pelo .xcworkspace** e não pelo .xcproject.
</Aside>

5. Certifique-se de que seu **Deployment target corresponde ao do Runner target**; caso contrário, você pode enfrentar um problema ao construir seu aplicativo (por exemplo, se você especificar iOS 10.0 no Runner e iOS 15.5 nos targets da NotificationService).

6. Adicione a **capacidade App Groups** aos targets Runner e NotificationService e adicione um novo grupo com o mesmo nome para ambos os targets:

<img src="/flutter-setting-up-badges-for-flutter-3.webp" alt=""/>

<img src="/flutter-setting-up-badges-for-flutter-4.webp" alt=""/>

7. Adicione a flag **PW_APP_GROUPS_NAME** do info.plist aos targets Runner e NotificationService com o nome do grupo como seu valor de string:

<img src="/flutter-setting-up-badges-for-flutter-5.webp" alt=""/>

8. Vá para **NotificationService.m** e substitua seu código pelo seguinte:

```objective-c
#import “NotificationService.h”
#import &#x3C;Pushwoosh/PWNotificationExtensionManager.h>

@interface NotificationService ()
<strong>@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
</strong>@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end

@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];
    [[PWNotificationExtensionManager sharedManager] handleNotificationRequest:request contentHandler:contentHandler];
}
- (void)serviceExtensionTimeWillExpire {
    // Called just before the extension will be terminated by the system.
    // Use this as an opportunity to deliver your “best attempt” at modified content, otherwise the original push payload will be used.
    self.contentHandler(self.bestAttemptContent);
}
@end
```


## Compartilhe seu feedback conosco

Seu feedback nos ajuda a criar uma experiência melhor, então adoraríamos ouvir de você se tiver algum problema durante o processo de integração do SDK. Se você enfrentar alguma dificuldade, não hesite em compartilhar suas opiniões conosco [através deste formulário](https://docs.google.com/forms/d/e/1FAIpQLSd\_0b8jwn-V\_JmoPLIxIFYbHACCQhrzidOZV3ELywoQPXRSxw/viewform).