Jump to content

Snippet Expansion Into iOS Simulator Clears Text Field


Recommended Posts

Build Info

Alfred Version 3.7

Alfred Build: 938

macOS Version: 10.13.6

 

What You Were Doing

Trying to expand an email address in an iOS app in the iOS simulator while developing

 

Able to Replicate?

Yes, repeatedly

 

Issue

When I try to expand a snippet into the iOS simulator, be it via auto expansion or not, the snippet tries to expand, but the text field clears. I tried this in multiple text fields (my own app and Settings.app).

 

Potential Solutions

1. Expand the snippet if possible. I know the iOS simulator can be finicky to get text into, so this may be impossible.

2. If #1 is not possible, detect when an iOS simulator is the active app, and if so, temporarily disable snippet expansion. This would be better than having the text field clear.

[Edit: You can do this yourself with Alfred]

3. Something you smart people think of that I have not

 

Discussion

In my opinion, this is a more serious and unexpected issue when auto-expansion is enabled. It means the user needs to either disable auto-expansion of snippets or pick different keywords for iOS, since the user also needs to fall back to iOS's built in text replacement feature. Right now my workaround is going to be to place an "i" in front of the snippets I want to use in the iOS text replacement settings.

Edited by pasta
Link to comment
18 minutes ago, pasta said:

If #1 is not possible, detect when an iOS simulator is the active app, and if so, temporarily disable snippet expansion

 

You can do this yourself by blacklisting the simulator in Alfred's Snippets settings (hit the Auto Expansion Options button).

 

You can also try fiddling with the options in the Tweaking panel (same button) to make expansion work in the simulator.

Link to comment
27 minutes ago, deanishe said:

You can do this yourself by blacklisting the simulator in Alfred's Snippets settings (hit the Auto Expansion Options button).

 

Thanks, I'll do that. That allows me to get rid of the "i" prefix workaround I'm doing now.

 

28 minutes ago, deanishe said:

You can also try fiddling with the options in the Tweaking panel (same button) to make expansion work in the simulator.

 

I tried adjusting the tweaking options, but couldn't get snippet expansion working. Let me know if you have settings that are working for you.

Link to comment
14 minutes ago, pasta said:

Let me know if you have settings that are working for you.

 

I've never even used the iOS simulator, tbh.

 

Regarding snippets in general, I tend to use the system snippets where possible (so they sync to my iPhone & iPad) and fallback to Alfred when I need super-crazy advanced stuff like … newlines.

 

I get the impression from your post that iOS snippets also work in the simulator?

Edited by deanishe
Link to comment
16 minutes ago, deanishe said:

I get the impression from your post that iOS snippets also work in the simulator?

 

Sort of. Settings -> General -> Keyboard -> Text Replacement is there, but as a developer I deal with different simulators for different devices and OS versions, and I'm not signed into iCloud for those. That means my iOS text replacements aren't synced to the simulators, which in turn means I need to add the text replacements to each simulator I use separately. There might be a non-Alfred related solve for that, but you can start to see why using Alfred snippets would be useful.

 

6 minutes ago, nikivi said:
16 minutes ago, deanishe said:

sync to my iPhone & iPad

 

Can someone explain me the use case of an iPad. I don’t get it. ?

 

Same reason you'd use the feature on your phone or Mac. For example I use it to type 3 letters for my email address (and for multiple email addresses). It's especially useful on an iPhone where you don't have a hardware keyboard, but it's still useful on iPad w/software keyboard, iPad with hardware keyboard, or Mac w/hardware keyboard.

Edited by pasta
Link to comment

No I meant that I think iOS is a pure consumption OS. I wouldn’t want to create anything on it because iOS is so lacking compared to mac. So it just seems silly to buy a huge pad unless you have lots of spare money. 

 

Although sketching on it can be useful. That’s the only thing I ever considered going for it. 

Link to comment

Oh, so you are just knocking the iPad. I get it, I don't use mine for power usage either. That doesn't mean I've never wanted to type my email address into a form on my iPad.

 

Can we try keep the thread on topic? I do want to see if this is a solvable bug or not. I'd rather not turn this into a platform war. I'm on a Mac all day, but I use all 3 devices for different things. The bug report is about expanding snippets into the iOS simulator on a Mac. Let's try to stick to that.

 

If not...well, I'm new here. I can't stop you.

Edited by pasta
Link to comment
Just now, nikivi said:

So it just seems silly to buy a huge pad unless you have lots of spare money. 

 

The iPad allows me to carry around the thousands of PDF documents I use for work and read them comfortably. So, it's basically also a pure consumption device for me.

 

Also, I like small phones that I can use with one hand (I have an SE).

 

Finally, I looked into replacing my old iPhone and old iPad with an iPhone 7 Plus, but it was more or less the same price as the SE and iPad combined. So I bought them instead, as the iPad is way better for reading A4-sized documents and the SE is way better at fitting in your pocket. And I can leave the iPad at home when I don't need it, but a Plus phone is always huge.

 

A lot of the time, I also have my 12" MBA in my work bag (in addition to the iPad) for doing "make stuff" kind of work.

Link to comment

 

24 minutes ago, pasta said:

as a developer I deal with different simulators for different devices and OS versions, and I'm not signed into iCloud for those

 

Ah, yeah. That sucks. Have you tried any other snippet expansion apps? Like, perhaps you also have Dash if you're a developer?

 

17 minutes ago, pasta said:

If not...well, I'm new here. I can't stop you.

 

Going off topic is kind of a thing here, as there's no Off-Topic forum for people to post in or for mods to move posts to. @nikivi isn't having a dig. He's not like that, and it was a genuine question.

 

I wouldn't sweat it: The off-topic posts will keep your thread nicely bumped to the top of the forum :)

Edited by deanishe
Add Dash recommendation
Link to comment

I just edited my post above. Do you have, for example, Dash? Perhaps try its snippet expansion? Just to see if it works, like.

 

Different snippet apps seem to work in different ways and some work with app A, but not B, while others work with B, but not A.

 

For example, I eventually moved most of my snippets over from Typinator to Alfred because Alfred works fine with neovim, but Typinator doesn't.

Link to comment

I do have Dash. I just tried it and it has the same issue :(

 

I have a feeling snippet expansion in Simulator won't be possible unless Alfred detects Simulator is the active app, and if so, types out the snippet instead of pasting (I think copy/paste then restore the clipboard content is how snippet expansion works with Alfred). That may or may not be an option depending on how quickly the simulator can accept keyboard input.

 

This is a limitation of how the iOS simulator works. If you paste into Simulator, it pastes to the simulator's clipboard instead of pasting directly to the screen as if you had long press -> Pasted from iOS.

Link to comment

I found a setting in Simulator's menu, Hardware -> Keyboard -> Send Menu Keyboard Shortcuts to Device. I was hoping this would allow the pasting that Alfred and Dash use for snippets to paste directly to Simulator. It does let you paste from the keyboard directly, which is nice, but for snippet-expansion I get the letter v now. Bummer.

Link to comment
59 minutes ago, deanishe said:

I eventually moved most of my snippets over from Typinator to Alfred

 

I had a few issues with Typinator myself in few apps. I found that sending them over to the developer behind the app (gue) had them solved in few days. He is very responsive. 

Edited by nikivi
Link to comment
4 hours ago, deanishe said:

Also, I like small phones that I can use with one hand (I have an SE).

 

I’m never one to reply with memes (though I can think of a meme to go with that), but I feel like posting the dozens of us Arrested Development scene.


I have no idea what I’ll do when my SE no longer supports the current iOS version. I find every new design since the 6 to be physically repugnant and have a hard time imagining myself using an iPhone that looks like that. I won’t switch to Android, though. So my options look like they’ll be to either use a device I don’t enjoy or stop using a phone. Option two doesn’t look as bad as you might think, given the alternative (yes, I dislike the looks that much).


Apple logic: “Let’s try an experiment and launch iPhone 5C. Meh, didn’t sell as much as it could, let’s discontinue it”. Some years, later “Hey, let’s try another experiment and launch iPhone SE. Waw, it sold way better than we ever expected, people really like that design, let’s discontinue it”. Maybe for an experiment to continue it’d have to sell exactly as they projected?

 

4 hours ago, deanishe said:

Going off topic is kind of a thing here, as there's no Off-Topic forum

 

I wonder if we’d ever use it.

Link to comment

@pasta Welcome to the forum! I see you've met a few of our regulars already ;)

 

*grabs the reins and steers topic back on course* Looks like you've tried a few things already, but what happens when you manually copy something to your macOS clipboard and use Cmd + V to paste it in the iOS simulator? Given you say it's now pasting "V" when trying to expand snippets, it looks like it's trying to pass the Cmd + V through but isn't succeeding.

 

First, you can try slowing down key events in Alfred, in case the iOS simulator is being slow but can receive the paste from the macOS clipboard: 

https://www.alfredapp.com/help/troubleshooting/snippets/#partial

 

Next, take a look at whether you might've changed the default macOS paste hotkey to something else, or use keyboard remapping/hotkey modifying software that could be stopping Alfred's pasting from happening normally.

 

Having said that, it may very well just be a limitation of the iOS Simulator... Let me know how you get on. :)

 

Cheers,
Vero

Link to comment

Hi @Vero,

 

All good about going off-topic. I didn't realize there was no off-topic section of the forum. I should have checked for that first.

 

12 hours ago, Vero said:

Looks like you've tried a few things already, but what happens when you manually copy something to your macOS clipboard and use Cmd + V to paste it in the iOS simulator? Given you say it's now pasting "V" when trying to expand snippets, it looks like it's trying to pass the Cmd + V through but isn't succeeding.

 

By default, it will paste to the iOS clipboard in the simulator. Then you can paste from iOS to paste the content. If you enable the setting to send menu keyboard shortcuts to the device, you can paste directly to the device; however, that doesn't make Alfred snippets start working, unfortunately. It also makes the simulator pretty unusable as a develop because I'd lose all my keyboard shortcuts.

 

I tried slowing down the key events all the way, with and without that setting enabled, but had no luck.

 

12 hours ago, Vero said:

Next, take a look at whether you might've changed the default macOS paste hotkey to something else, or use keyboard remapping/hotkey modifying software that could be stopping Alfred's pasting from happening normally.

 

That I'm sure I haven't done. It's cmd + v for me.

 

12 hours ago, Vero said:

Having said that, it may very well just be a limitation of the iOS Simulator... Let me know how you get on. :)

 

I think that's true, it's a limitation of the simulator that when you paste from macOS it goes to the iOS clipboard but does send a paste iOS event. That being said, I think Alfred could work around this by sending key events of the snippet contents (1 character at a time, quickly) to Simulator (this would only be needed for Simulator). It wouldn't be as fast as pasting, but it should work in theory.

 

I know this is a pretty rough edge-case, but with Alfred being a power user tool, I think a lot of iOS devs use it and would appreciate this feature. Right now all we have is text replacement, and that is not shared across simulators, of which we deal with _many_. Being able to use Alfred snippets in Simulator would be a major productivity boost for things like filling out forms.

Link to comment

@pasta Have you tried popping up Alfred's clipboard, doing Cmd + C on the snippet you want, then using the iOS Simulator app's Edit > Paste command? I believe that particular Paste uses the macOS clipboard. If that works, you could try automating that with a workflow.

 

12 hours ago, pasta said:

could work around this by sending key events of the snippet contents (1 character at a time, quickly) to Simulator (this would only be needed for Simulator)

 

Since the beginning, Alfred has contained as few edge-case "work differently for this app/scenario" modifications as possible. Quite simply, edge cases for individual apps require constant monitoring of the app for any changes, and we'd end up chasing every app with fixes every time the third-party app changes. Part of why Alfred works so smoothly and consistently is that there are as few of these edge-cases as possible built into Alfred. 

 

Given our active involvement with the community, we can get a pretty good feel of what features would be beneficial for a sufficient volume of users to warrant investigating an edge case, and I don't think it's the case here.

 

Cheers,
Vero

Link to comment
4 hours ago, Vero said:

Have you tried popping up Alfred's clipboard, doing Cmd + C on the snippet you want, then using the iOS Simulator app's Edit > Paste command? I believe that particular Paste uses the macOS clipboard. If that works, you could try automating that with a workflow.

 

That's a good idea, but Edit -> Paste pastes to the iOS clipboard in Simulator (not into the app that's running). Unfortunately there's no key command tied to the Send Menu Keyboard Shortcuts to Device menu item. If there were, I could probably create a workflow to temporarily turn that on, paste the snippet, and turn it back off. Let me know if you think of any other possible workarounds.

 

4 hours ago, Vero said:

Given our active involvement with the community, we can get a pretty good feel of what features would be beneficial for a sufficient volume of users to warrant investigating an edge case, and I don't think it's the case here.

 

Understood. I was hoping iOS developers would be a large enough portion of your users that this could be one of those edge cases, but, if after years I'm the only one that's reported it, I totally understand not wanting to add code for this special case to the app. If it were my app, I probably wouldn't want to either.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...