Hey,
I tried adding a user avatar to my notifications using a Notification Service Extension.
let (imageData, _) = try await URLSession.shared.data(from: URL(string: profile.profilePictureLink)!)
let handle = INPersonHandle(value: profile.profileId, type: .unknown)
let avatar = INImage(imageData: imageData)
var nameComponents = PersonNameComponents()
nameComponents.givenName = profile.firstname
nameComponents.middleName = profile.middlename
nameComponents.familyName = profile.lastname
nameComponents.nickname = profile.username
let sender = INPerson(personHandle: handle,
nameComponents: nameComponents,
displayName: profile.displayName(),
image: avatar,
contactIdentifier: nil,
customIdentifier: profile.profileId,
isMe: false,
suggestionType: .none )
let intent = INSendMessageIntent(recipients: nil,
outgoingMessageType: .outgoingMessageText,
content: messageText,
speakableGroupName: INSpeakableString(spokenPhrase: profile.displayName()),
conversationIdentifier: receiverId + "_" + ownerId,
serviceName: nil,
sender: sender,
attachments: nil)
intent.setImage(avatar, forParameterNamed: \.sender)
let interaction = INInteraction(intent: intent, response: nil)
interaction.direction = .incoming
interaction.donate(completion: nil)
do {
let updatedContent = try bestAttemptContent.updating(from: intent)
contentHandler(updatedContent)
} catch {
print(error)
}
I've added the communication notification entitlement to my app. As well as the NSUserActivityTypes in my main target's Info.plist. I also added IntentsSupported to my Notification Service Extension's Info.plist. I also tried it with NSUserActivityTypes but neither of them works.
Also I see these logs in console:
2022-11-19 21:29:07.490915+0100 NotificationService[5252:369887] [Intents] -[INCache cacheableObjectForIdentifier:] Unable to find cacheable object with identifier F1FE1921-0894-5FEB-FF33-934EAD5C6E4F in cache.
2022-11-19 21:29:07.491058+0100 NotificationService[5252:369887] [Intents] -[INCache cacheableObjectForIdentifier:] Unable to find cacheable object with identifier F1FE1921-0894-5FEB-FF33-934EAD5C6E4F in cache.
2022-11-19 21:29:07.510673+0100 NotificationService[5252:369888] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
2022-11-19 21:29:07.510708+0100 NotificationService[5252:369888] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.
2022-11-19 21:29:07.510737+0100 NotificationService[5252:369888] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
2022-11-19 21:29:07.510789+0100 NotificationService[5252:369888] [Intents] +[INAppInfo appInfoWithAppProxy:] Unable to create app info with application record: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
2022-11-19 21:29:07.579663+0100 NotificationService[5252:369887] [RemoteNotifications] [A946BFD5-50A2-4140-835B-A23047340D1F] Ignoring additional replacement content replies for notification request 2FDA-6FE6
2022-11-19 21:29:07.579879+0100 NotificationService[5252:369900] [Intents] -[INCache cacheableObjectForIdentifier:] Unable to find cacheable object with identifier intents-remote-image-proxy:?proxyIdentifier=F1FE1921-0894-5FEB-FF33-934EAD5C6E4F.png&storageServiceIdentifier=com.apple.Intents.INImageServiceConnection in cache.
2022-11-19 21:29:07.580177+0100 NotificationService[5252:369900] [Intents] -[INCache cacheableObjectForIdentifier:] Unable to find cacheable object with identifier intents-remote-image-proxy:?proxyIdentifier=F1FE1921-0894-5FEB-FF33-934EAD5C6E4F.png&storageServiceIdentifier=com.apple.Intents.INImageServiceConnection in cache.
Does anybody know what I'm missing?
Post
Replies
Boosts
Views
Activity
I just noticed, that iOS 16 is using the accent color for the navigation bar back button. (SwiftUI) When running my app on iOS 15 devices it's white.
Is there a way to change that behavior? I want to have another accent color than white.
When I use the new Xcode beta to build my app it crashes on launch when using iOS 15.5. However if I use a device using the iOS 16 beta it works as expected.
The error I'm getting is the following.
dyld[11076]: Symbol not found: _$sSo26UIContextMenuConfigurationC5UIKitE10identifier15previewProvider06actionG0ABSo9NSCopying_pSg_So16UIViewControllerCSgycSgSo6UIMenuCSgSaySo0L7ElementCGcSgtcfC
Referenced from: /private/var/containers/Bundle/Application/89EF89C9-3922-4E6C-BA00-0241894841B8/SomeApp.app/SomeApp
Expected in: /usr/lib/swift/libswiftUIKit.dylib
Symbol not found: _$sSo26UIContextMenuConfigurationC5UIKitE10identifier15previewProvider06actionG0ABSo9NSCopying_pSg_So16UIViewControllerCSgycSgSo6UIMenuCSgSaySo0L7ElementCGcSgtcfC
Referenced from: /private/var/containers/Bundle/Application/89EF89C9-3922-4E6C-BA00-0241894841B8/SomeApp.app/SomeApp
Expected in: /usr/lib/swift/libswiftUIKit.dylib
(lldb)
Is it missing some libraries? If I use the stable Xcode 13 Version it works as intended.
I know this is still beta but I'm wondering if anyone else is having this problem or am I missing something?
I'm trying to implement a Gridview with photos stored in the photos app so the user can choose one picture and pick that as his profile picture. Before SwiftUI I used the collection view and Photos Kit to fetch the images and display them in a grid.
Now that I switched to SwiftUI I tried to use LazyVGrid. I am able to fetch all the photos of the user and display them in a Grid. However it uses a lot of memory. I had a memory leak before but now Instruments isn't showing any leak any more.
I thought it may be, that the Grid isn't really unloading the displayed images, when it gets invisible to the user. However if you scroll up and down multiple times it just uses a lot more memory than before. Like the grid is creating always new views and the old ones don't get deleted. Am I using something wrong or misunderstand the principles of LazyVGrid?
My current code
Hey,
is it possible to add an inputAccessoryView to a SwiftUI View? As we can override the inputAccessoryView field on a UIKit ViewController?
I'm working on a messaging app, which needs to display the message input view all the time and "attach" it to the keyboard ones it's appearing.
If if just have a View at the bottom it's moving up and down with the keyboard automatically but once I use .interactive dismissing on my scrollView my view stays up until the keyboard is fully dismissed, which doesn't look good.