iOS Share Extension Doesn't Terminate - ios

I've created an iOS share extension with a custom UI (not using SLComposeServiceViewController) and everything works great.
Once the extension is invoked, it takes a shared URL or text and sends it. That's all it does and it works well.
The custom UI is simple. One image view that shows a graphic indicating that it is sending and then that changes to say "Sent" once done. Then this fades out.
What is going wrong is after this is done, the extension seems to disappear, but I can't control the host application anymore. It's as if an invisible window or view is on top of everything. (For example, an image rotator in Safari still rotates, but I can't scroll or tap links or buttons, etc.)
I'm calling [self.extensionContext completeRequestReturningItems:nil completionHandler:nil]; once the share is done, and as I understand it, that should dismiss my UI. I've also tried [self.view removeFromSuperview] without any luck.
Happens on Simulator and Device. Is there something I'm missing?
Edit: This is what the view hierarchy of a simple app I built to test sharing looks like in Reveal before and after sharing. The app has two buttons: share text and share url, each of which bring up a standard share sheet.
Before
http://joshh.is/1utYnKS
After
http://joshh.is/1rdVo34

Ok, I don't know why it took me 10 hours to realize that I was not including a call to super inside of my beginRequestWithExtensionContext: method.
I don't know what other problems that caused, but it certainly caused my problem above.

Related

iOS Share extension close action

I've encountered some strange behavior of the share extension - when sharing a text, perform small drag action and let it bounce back up - it closes(not doing so with images). I've tried it with plenty of other apps - Twitter, slack - same there. Then I've tried it with the system mail application and noticed that it asks to save the draft. So apparently, there is a way to intercept this action somehow. Any ideas on how to do that? (existing completerequest or cancelrequest are not called in the code).
Also I've tried to avoid this by presenting the extension in a fullscreen mode, using
NSExtensionActionWantsFullScreenPresentation(I know that it is intended to work with action extensions, but I found that it worked for someone with sharing extension).
But it doesn't work for the sharing extensions anymore. And once again, we can see applications that run their share extensions in a fullscreen.
UPD:
isModalInPresentation = true helped to avoid dismissal by drag.
But still nothing regarding showing the extension in a fullscreen mode.

Prevent Notification thumbnail from showing when 3D-touching

I am creating notifications in an app with iOS >10. When I attach an image to this notification, it shows exactly as I want it, but when the user 3D-touch the notification, the image is shown almost full screen.
The image has almost nothing to do with my notification; it only works as an indicator, and I would like for it to keep the tiny 70px thumbnail-size when a user force-touches it, or remove it all together in this expanded state. Is this possible?
This is exactly as I want it ^
I do not want the image to grow so much!
Is there a way to prevent the thumbnail from being this huge? The image's size is 70x70..
I ended up using a NotificationContentExtension to solve this. This extension adds a new target to your project, with its own storyboard and .plist and everything. It was really overkill for my project, as it was a lot of work, but I wanted to get rid of that blown-up thumbnail.
This extension can communicate with your app, so we were able to put a lot of nice information into the extended notification, and it actually turned out looking great. You design everything yourself, like what happens when you 3D-touch a notification from the Calendar app. You could probably also use an empty xib/storyboard for this extension to simply remove the thumbnail, but I just went nuts and created gold. It is practically a UIViewController that you can design to show whatever you want.
I did read quite a few tutorials on the matter. This is one of them.

Take screenshots programmatically of entire scrollable area of another app in iOS

Currently it is cumbersome for the user to repeatedly scroll and take a screenshot if they want to capture more than what can fit on the screen at a time.
I would like to implement functionality such that at the request of a user (e.g. via tapping a special button on a custom keyboard), screenshots of the entire scrollable area of the currently opened app are automatically taken and stitched together.
Is this possible? And if so, how?
To clarify, the application containing the scrollable area is a third party application over which I have no control, e.g. iMessage or Facebook.
Edit: I am aware of answers like this one and this one that are about taking screenshots within an app that I control. As far as I can tell, these are not applicable in my situation. Please correct me if I am wrong about this.
This is not possible. Each app is contained in a protected sandbox that no other apps have access to.
You could make a custom keyboard, but you still wouldn't have access to any of the views in the app that you don't control.

Tabbed iOS WebKit Browser with Swift

In short I am trying to build some typical browser functionalities in a Swift iOS app with WKWebViews (WebKit). I already have a functioning browser based on a WKWebView, which already has a menu bar with a URL input, navigation buttons, a share button, page title etc.
What I am struggling with is creating tabs for the browser. At first this seemed trivial as surely WKWebViews would support this in some way. Well, as far as I can tell they do not (looked at and tried multiple tutorials incl. hackingwithswift, Ray Wenderlich etc. + I checked Apple's documentation + stackoverflow)
This is what I have come up with so far:
1) Creating a new tab/opening a new URL should create a new UIView + WKWebView programmatically (I'll have to make a subclass out of my current browser view)
=> this should create a separate thread for each WKWebView/tab according to Apple's documentation
2) I need something like a Collection View (or Stack Views etc.) to store screenshot images of the already open tabs as a preview page of all tabs. The cells should be linked via a delegate to the corresponding WkWebView and they should have a close button to close (= delete) the tabs.
Am I overthinking this? If I go down this path I have to find a way to wire up (and subsequently delete) multiple delegates and views to the Collection View dynamically and I have to store & delete screenshots every time the user interacts with the tabs. It seems VERY messy. But given that Chrome on iOS is based on WebKit as of late, it's obviously doable.
How would you tackle this problem?
PS I didn't include a mockup because you all know how the tabs in Chrome, Safari etc. on iOS look like.
EDIT:
I am just looking for a clean and sensible way to add/remove and show the multiple WKWebViews, which are created by opening new tabs - just like in Chrome for iOS or Safari etc.
Ok, I have solved this today :) I will have a main UIView and then multiple WKWebViews, which can be "zoomed in" in order to enter full screen mode. No need for screenshots etc.

How to make my LaunchImage load at the same time as the application?

As the application loads, I want to make an image load at the same time, for example, a line would elongate form either side as the application loads, and when it has finished, the line would have reached its maximum length. I have seen this in a few websites, like rime arodaky for example, but I want to this for an iOS application. I have searched on Google but couldn't find anything!
Does anyone know how to do this?
The launch process if we REALY simplify it to accommodate your question, can be split into two parts.
The first part you do not have any control over, and during which a launch image is shown.and it ends with a delegate call-back on the application delegate called
applicationDidFinishLaunchingWithOptions
The second part is you might have some application specific behaviour which requires no activity from the user but you app still isn't interactive.
You need to implement such a progress bar yourself. There is no built in support for this in any of the app templates in Xcode.
You can only do what you want during this second phase. But you have absolutely no control over the first phase, except for that static non-animated launch image.
I think you can just add a photo as a launch image, launch image is just an image.Then you can add the animation when your first view controller appears.You can fake it this way.

Resources