Post

Replies

Boosts

Views

Activity

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
482
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
798
Nov ’23