iOS9 FBSDKShareDialog native sharing not completes a post to facebook - facebook

I have an app written in Swift3 for iOS9 which attempts to share a custom link with image and description to facebook. The inter-app switching Plist keys are configured correctly - the user is asked for permission to open facebook, then a native facebook post is created in FB app.
The issue is that upon tapping Post, the user is returned to my app, but the FB post does not complete. I see a little black screen with a progress indicator flash, but the user is returned to my app before the progress is filled. (Same progress indicator fills up when using "automatic" share mode within the app)
How to make sure that FBSDKShareDialog completes posting a link to facebook native app before returning to my app?
let content = FBSDKShareLinkContent()
content.contentURL = URL(string: "http://customurl.com/")
content.contentTitle = "Custom Title"
content.contentDescription = "Custom description"
if let imageUrlUnwrapped = imageUrl {
content.imageURL = URL(string: imageUrlUnwrapped)
}
let dialog = FBSDKShareDialog()
dialog.fromViewController = self;
dialog.shareContent = content;
let url = URL(string: "fbauth2://")
if UIApplication.shared.canOpenURL(url!)
{
dialog.mode = FBSDKShareDialogMode.native
}
dialog.show()

Related

App Store link "rate the application" in SwiftUI

I just updated my "Rate the application" button that I'm using in all my apps. Actually, I would prefer to get not only a rating but a rating + a comment.
So I replaced this:
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
SKStoreReviewController.requestReview(in: scene)
}
By this:
let url = URL(string: "https://apps.apple.com/app/(AppName)/(AppID)?action=write-review")!
UIApplication.shared.open(url)
And it's working perfectly fine!
But now, I'm wondering what should I do about the "encryption request" from Apple? Some people say there's no need for a "https" call to the App Store but Apple says a bit different: https://help.apple.com/app-store-connect/#/dev88f5c7bf9
What you guys are doing? Did you asked a document from the BIS or not?

How do I use background fetch in iOS 13 to update pdfs?

I watched many videos and read many articles about the new background fetch in iOS 13, but I am still in the dark. I am making a dining app. Amongst other things I am presenting the menu for "today", which is changing every day. So far I use the PDFKit to show an example menu of a restaurant and have the menu for "today" and "tomorrow" downloaded into my project folder, but I want to use background fetch to get the menu updated every day. So far I only understood that I will have to check the boxes for "background fetch" and "background processing", where the refresh task is used to update content and the processing is used to clean up.
I am also wondering if I need my own website where I upload the pdf to retrieve the url from there. In the end I have to update an image and some labels as well, but I hope that I'll be able to do that on my own once I understood the principles.
I show you my code and screenshot of my view controller to give you a better understanding of my app so far.
let today = "AmericanDinerMenu" // PDF 1 with menu for today
let tomorrow = "ConniesDinerMenu" // PDF 2 with menu for tomorrow
func activePDF(PDF: String) {
if let path = Bundle.main.path(forResource: PDF, ofType: "pdf") {
let url = URL(fileURLWithPath: path)
if let pdfDocument = PDFDocument(url: url) {
pdfView.displayMode = .singlePageContinuous
pdfView.autoScales = true
pdfView.document = pdfDocument
}
}
}
I hope you can help me. Thank you!

ios swift FBSDKShareKit Publish (Share) content without ShareDialog view controller

i want to put function with "sharing facebook" when "user start live"
if that Fb Button is on then user touches that Live Button,
the content will publish on user's timeline on facebook automatically, then start "Live Broadcasting"
so the ShareDialog will not be present up.
but if ShareDialog should be presented for permission,
i want to do it when user touches that fb button.
======== ref
https://developers.facebook.com/docs/sharing/opengraph/ios
var content = FBSDKShareLinkContent()
content.contentURL = URL.init(string: "https://www~")
content.hashtag = FBSDKHashtag(string: "#ABCDE")
// content.contentTitle = self.broadcastingInfo.title ?? ""
// content.imageURL = self.broadcastingInfo.image
// var shareDialog = FBSDKShareDialog()
// shareDialog.shareContent = content
// shareDialog.mode = .native
// try shareDialog.show()
// do not want shareDialog
FBSDKShareAPI.share(with: content, delegate: self)
// error : The operation couldn’t be completed. (com.facebook.sdk.core error 8.)

FBSDKSharePhoto not sharing link alongside photo using Swift

When I try to share a link along with a picture, at the same time, via FBSDKSharePhoto, only the photo gets shared. No link appears.
Here is the code I use:
let photo : FBSDKSharePhoto = FBSDKSharePhoto()
photo.image = self.scaledImage
photo.userGenerated = true
let content : FBSDKSharePhotoContent = FBSDKSharePhotoContent()
content.contentURL = NSURL(string: self.short_string)
content.photos = [photo]
let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content
And a picture of the resulting dialog when I push the button: http://imgur.com/mZ483i9 (also attached)
You can see the picture gets attached to the post, but there is no link. I know all of the URL/Photo variables work fine because they are used elsewhere.
If I switch the sharing method to FBSDKShareLinkContent then content.contentURL works fine, but I cannot post the picture this way because the picture is not hosted on the web, which is why I am using FBSDKSharePhotoContent. (The picture is taken within the app.)
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: self.short_string)
content.contentTitle = self.title_text
content.contentDescription = self.desc_text
content.imageURL = NSURL(string: "http://randomimage.jpg/")
let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content
So I know my link is structured properly according to the contentURL protocol, and FBSDKSharePhotoContent conforms to the same functions as FBSDKShareLinkContent. No clue why it won't work.
Due to Facebook rules you can`t set non user generated text.

How to load google street view in a UIWebView of iphone app?

I am trying to use the google map street view in my app, so i am trying to load the html file in my Webview. but it is need the flash player to show the street view.
Is adobe flash player is required for this?
Anyone know how to use the street view in our iphone app?
Regards,
Yes, it is possible to load Google StreetView in UIWebView. Here is a sample code example to load Google StreetView -
let urlAddress = "http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=bran+castle&sll=44.439972,26.096894&sspn=0.000869,0.003664&ie=UTF8&hq=Bran+Castle&hnear=Bran+Castle,+Strada+General+Traian+Mo%C8%99oiu+nr.+28+E574,+Bran+507025,+Romania&t=k&layer=c&cbll=45.516381,25.368123&panoid=0d7jjq7vdWGTxFyonEKnBQ&cbp=12,209.81,,1,-18.52&ll=45.516381,25.368123&spn=0,0.008444&z=17";
let request = NSURLRequest(URL: NSURL(string: urlAddress)!)
glWebView.loadRequest(request)
After loading this streetView. Google will give you an alert that this URL is belongs to google map only. To hide that alert message just add this below javascript query in your WebViewDidFinish method -
webView.stringByEvaluatingJavaScriptFromString("document.getElementsByClassName('ml-unsupported-link-dialog-container')[0].style.display='none'")
Well technically it is not possible, but if you can get the panorama image id for that specific latitude and longitude, then it is possible. In my previous answer, I said it is possible as because I know the panorama id for that specific location. Using that code you can open steetview in your UIWebview, but it will show a warning. By touching anywhere in your webview will disappear that warning alert.
Bu Google introduce there SDK to load streetview in your iOS app, instead of leaving your app. All you need to do is add 'GoogleMaps' sdk using cocoa pods and run this below source code to display google Streetview for specific latitude and longitude.
let panoSvc = GMSPanoramaService()
panoSvc.requestPanoramaNearCoordinate(CLLocationCoordinate2D(latitude: 32.847683, longitude: -96.771638), radius:100, callback: { (panorama, error) in
if error == nil {
DispatchQueue.main.async(execute: {
let panoView = GMSPanoramaView(frame: .zero)
self.view = panoView
panoView.moveNearCoordinate((panorama?.coordinate)!, radius: 200)
print("Panorama ID: ", panorama?.panoramaID)
print("Panorama Co-ordinate: ", panorama?.coordinate)
})
}
else {
Utility.showCustomMsg(self.view, label: "Not Found", detailslbl:"Street View is not available for this location.", isSuccessImg: false, duration: 3)
{
self.navigationController?.popViewController(animated: true)
}
}
})
Cool huh...... Thanks goes to Google for their cool staff.