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

[BUG] Push Notifications: 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead. #1672

Closed
mattials opened this issue Jan 4, 2024 · 6 comments
Assignees
Labels
Communication - Chat customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@mattials
Copy link
Contributor

mattials commented Jan 4, 2024

Describe the bug
Encountered the error message: "'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead." in ApplicationUtil.swift line 49 -> return UIApplication.shared

Exception or Stack Trace
'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.

To Reproduce
Followed the Microsoft Azure tutorial link for integrating push notifications into a chat application.
Encountered the error message: "'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead."

Code Snippet
ApplicationUtil.swift line 49 -> return UIApplication.shared

Expected behavior
Successful compilation without errors on ./add-chat-push-notifications in xcode 15.

Screenshots
Issue

Setup (please complete the following information):

  • OS: iOS 17.0.2
  • IDE : xCode 15
  • pod 'AzureCommunicationChat', '~> 1.3.3'

Additional context
Encountered the same issue in both a direct integration into the chat project and when using the Microsoft-provided example project link. The issue appears to be related to the AzureCore dependency, and a possible solution was suggested in the Apple Developer Forums link, recommending the use of @available(iOSApplicationExtension, unavailable). This change may need to be implemented in the Azure SDK to resolve the issue.

Azure-Samples/communication-services-ios-quickstarts#70

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 4, 2024
@tjprescott
Copy link
Member

@angellan-msft can you please take a look.

@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 4, 2024
@angellan-msft
Copy link
Contributor

@mattials , I just returned to office and will look into it next week.

mattials added a commit to mattials/azure-sdk-for-ios that referenced this issue Jan 8, 2024
@mattials
Copy link
Contributor Author

@angellan-msft @tjprescott I created a PR, I tested locally to fix the error, can you check it please 🙏

#1673

@angellan-msft
Copy link
Contributor

Note: I'll keeping providing the update in the PR created by the customer.
PR link: #1673

@mattials
Copy link
Contributor Author

The workaround: #1673 (comment)

tjprescott pushed a commit that referenced this issue Jan 17, 2024
@tjprescott
Copy link
Member

Fixed in #1673.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Communication - Chat customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants