Is it possible to perform API calls from Share extension - ios

I am not sure whether it's possible or not but I want to perform GET API call from share extension and display result on it.
Not sure how Whatsapp is performing POST call from share extension. Any suggestion would be helpful. Thanks.

Finally, I got working solution using NSURLSession, I tried Alamofire but it was not working. Thanks Salman for your suggestion. :)
I think Alamofire is not available because in my pod file I have not set target to extension's target

Related

NativeScript - How to create a webview with request blocking/redirection?

I'm trying to create a webview with the capability to block/redirect certain urls requested inside the webview (not just the page url, but also the requests sent from the page, think of it as what a browser extension is able to do).
After some research, the closest I get was this Swift/Obj-c approach of use NSUrlProtocol: https://www.raywenderlich.com/2292-using-nsurlprotocol-with-swift, and the doc of the native-webview-ext mentioned something about WKURLSchemeHandler https://github.com/Notalib/nativescript-webview-ext .
I'm new to mobile development and this feature is crucial for my project. I wonder if anyone has experience building this out in NativeScript, I hope I don't have to convince my team and my boss to write this in Swift instead :(.
As you see in the webview-ext plugin docs, it does support overriding resource urls. Refer the registerLocalResource method.
Just in case, even if that is not supported you don't have to write your whole project in Swift as you can always access all native apis from JavaScript / TypeScript itself, read more about it here.

react-native-fetch-blob IOS API openDocument not working

I require showing applications in the IOS device capable of opening various file formats.I tried using react native share to achieve the same but options of copying file to other apps did not appear.So i tried using react native fetch blob. RNFetchBlob.fs.exists(fs.dirs.DocumentDir+'/sample.pdf') return true , meaning the file does exist but when i use RNFetchBlob.ios.openDocument(fs.dirs.DocumentDir+'/sample.pdf') nothing happens, not even an error but rather the success callback is called. Appreciate any help.
I was able to resolve the issue , but i don't know why it actually happened in the first place. I used an Alert.alert to find if the file existed or not and then called the RNFetchBlob.ios.openDocument function, upon removing the alert just before the function call it started working.Posting this answer incase it does happen to anyone else.

How i can use AFHTTPNetworking for downloading and uploading images in ios

I am using AFHTTPNetworking In my tutorial.
I have one OutLet of ImageView
and I want to show some images from server.
I have server url like this link. I have not worked with this and i am new in iPhone. Can anyone suggest me a proper tutorial for this ?
I think you should read the tutorial: http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial.
This is a tutorial is easy to understand about what should you need to solve your problems.
I would like to advice you to use SDWebImage library. It's among the best library I have used for Image caching.
Import UIImageView+Webcache in your project and use sd_setImageWithURL method.

Can I bundle /package two apps into one?

I have two apps. The first one checks for passwords and credentials and if all is well, then launches the second app. Can I bundle/package the two apps into one? The intent is to present the whole thing as a single app to the Appstore.
Is this approach supported for iOS and accepted by Apple?
How about framework? Although I think a customised framework is not supported for iOS which is of no use to my case.
Any hints or code samples as how to achieve this (if at all possible) is very much appreciated.
Thank you for your help.
You can't bundle two apps, but you can write your own framework that checks credentials and add that to your app. From the information you give, I can't see the reason why you need to put credential checking into an extra framework. Can't you do the check inside your app?
I suggest you to create a library for Login (where you can check the credentials of user once authentication is success use protocols to send the information of user or the status (success or failure) to the main app where your total application is presented). Creating a library (.a and .h) file is easy here you can't use Xib files and images for this you need to create a new bundle where all your Xib's and images are added for library purpose. In other case you can use images as a base64 string. So your total app is now splitter into 2 parts 1. Library for Login 2.All other features. If you need more information on this please let me know.
Hope this will give you an idea and helpful

Read firefox extension version from the extension code itself

I'm developing a firefox extension and I'm looking for a way to access (read) the version of my extension from the extension code itself.
Thanks.
This post provides the APIs you would need to use to make this work. Even has sample code!
You can use nsIFile and read your own .rdf, I suppose.

Resources