Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 10 Swift 3 support #16

Closed
Toolenaar opened this issue Sep 19, 2016 · 6 comments
Closed

iOS 10 Swift 3 support #16

Toolenaar opened this issue Sep 19, 2016 · 6 comments

Comments

@Toolenaar
Copy link

I have a project which I have just updated to swift 3 and iOS 10. I use the Windows.AzureMessaging.Framework in this project, but it seems the tutorial site (https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-ios-apple-push-notification-apns-get-started/) does not point to an updated version for swift 3. Is there an updated version and if so where can I find it ?

@A1iAshoor
Copy link

I feel Microsoft are way behind in every aspect..

@anooprawat1
Copy link

For using in swift project.
Make sure you add bridging header in your project and import correct file name

#import "WindowsAzureMessaging/WindowsAzureMessaging.h"

@aboudijaber
Copy link

I guess this link should be helpful to achieve the task using iOS 10 and swift 3.

https://docs.microsoft.com/en-us/azure/mobile-engagement/mobile-engagement-ios-swift-get-started

@johanrovala
Copy link

The documentation is a mess still. If your problem is that there is no documentation on how to retrieve the message for iOS 10 with userNotificationCenter(_ willPresent:UNNotification, withCompletionHandler:)
You should be able to get the json body via UNNotification.request.content.userInfo, although I have not tried this.

@Alessar Alessar transferred this issue from Azure/azure-notificationhubs Mar 5, 2019
@elvirberisha
Copy link

elvirberisha commented Mar 26, 2019

I found a solution and I post here all the steps to integrate the Azure Notification Hub with Swift:

  1. On your project root, create a new Folder called "Headers"
  2. Inside that Folder create a New File > Header File > Call it "HubInfo.h"
  3. Copy this code inside your HubInfo.h file (remember to replace the values of HUBNAME and HUBLISTENACCESS with your project's hubName and hubConnString):

#ifndef HubInfo_h
#define HubInfo_h

#import <WindowsAzureMessaging/WindowsAzureMessaging.h>

#define HUBNAME @""
#define HUBLISTENACCESS @""

#endif /* HubInfo_h */

  1. Select your project under "Targets" and then go to "Build Settings"
  2. Search for "bridging header" in the search field
  3. In "Objective-C Bridging Header" add your Header File: Headers/HubInfo.h
  4. In your AppDelegate add "import UserNotifications" on the top
    Then build the project and follow the tutorial here (starting from the step 8) using Swift instead of Objective-C: https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-ios-apple-push-notification-apns-get-started#connect-your-ios-app-to-notification-hubs

Bridging-Header

@marstr
Copy link
Member

marstr commented Aug 9, 2019

Seems like @elvirberisha has found a solution. I'm going to close/lock this issue as resolved.

@marstr marstr closed this as completed Aug 9, 2019
@Azure Azure locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants