Post

Replies

Boosts

Views

Activity

How to let iCloud sync across the devices without launching the app at midnight?
Hi, I have designed an app which needs to reschedule notifications according to the user's calendar at midnight. The function has been implemented successfully via backgroundtask. But since the app has enabled iCloud sync, some users will edit their calendar on their iPad and expect that the notifications will be sent promptly to them on iPhone without launching the app on their iPhone. But the problem is that if they haven't launched the app on their iPhone, iCloud sync won't happen. The notifications on their iPhone haven't been updated and will be sent wrongly. How can I design some codes to let iCloud sync across the devices without launching the app at midnight and then reschedule notifications?
4
0
296
2w
share photo to facebook but no dialog shows
Hi, Everyone I set up a class for sharing photos to facebook. The codes of the class are as following. But when I call the function "shareToFacebook", there is no dialog to show. What's the issue in these codes? I am using iOS 17.0, Xcode The guide from Facebook hasn't updated. import SwiftUI import FBSDKShareKit import FacebookShare @Observable class ShareFacebook { var content = SharePhotoContent() var images : [UIImage] = [] var photos : [SharePhoto] = [] func shareToFacebook() { for image in images { let photo = SharePhoto( image: image, isUserGenerated: true ) photos.append(photo) } content.photos = photos let dialog = ShareDialog( viewController: UIApplication.shared.currentUIWindow()?.rootViewController, content: content, delegate: nil ) dialog.show() } } //button for sharing //Sharing to Facebook Button { for image in photos { let image = UIImage(data: image.imageData) sharedPhotos.append(image ?? userViewModel.render(image: Image("photoForNil"))! ) } shareToFacebook.images = sharedPhotos shareToFacebook.shareToFacebook() }label: { Image("share") .resizable() .frame(width:18, height: 18) .padding(.trailing,30) }
0
0
518
Dec ’23
Textfield bug after upgrading to IOS 17.0
I have a textfield to allow users to input their numbers. It works well until I upgrade to IOS 17.0 yesterday. After upgrading to IOS 17.0, the number input by user can't be cleared when user wants to input another number. More specifically, the last figure can't be deleted.For example, the user originally input 50, and he/she wants to delete it to input another figure. But 5 can't be deleted and only 0 is deleted. So user can't input a new number in the textfield. Is a bug from IOS17.0? How can I fix it. My code about the textfield is as following: TextField("Focus Time", value: $userViewModel.focusTime, format: .number) .frame(width: 220, height: nil) .keyboardType(.numberPad) .textFieldStyle(.roundedBorder) .font(Font.system(size: 25, design: .default)) .multilineTextAlignment(TextAlignment.center) .focused($textIsFocused1) .onTapGesture { textIsFocused1.toggle() }
2
0
870
Nov ’23