如何从我的应用程序中打开“设置”应用程序? [重复]

时间:2022-05-11 02:12:46

This question already has an answer here:

这个问题在这里已有答案:

In an iPhone app I'm working on, the user needs to enter some configuration via the settings application before my app will be able to connect to a server and run. Right now when the user first launches my app, I display an alert explaining that the user should go to settings, enter the config details and then relaunch, but this isn't ideal.

在我正在处理的iPhone应用程序中,用户需要通过设置应用程序输入一些配置,然后我的应用程序才能连接到服务器并运行。现在,当用户首次启动我的应用程序时,我会显示一条警告,说明用户应该进入设置,输入配置详细信息然后重新启动,但这并不理想。

Unfortunately there's no way for me to provide sensible defaults for this app, the server host names, user accounts etc. will vary for each user. I think the best I can hope for is to show an alert explaining that some configuration needs to be entered via settings, and provide a "Take me there..." button that will open settings and then open the section in settings for my app. If that's not possible, opening settings is better than nothing.

不幸的是,我无法为此应用程序提供合理的默认值,服务器主机名,用户帐户等因用户而异。我认为我能希望的最好的方法是显示警报,说明某些配置需要通过设置输入,并提供“带我去那里......”按钮,打开设置,然后在我的应用程序的设置中打开该部分。如果那是不可能的,打开设置总比没有好。

I vaguely remember that the iPhone jailbreaking people had figured out a way to launch settings or other apps via a funny URL or phone number in the Addressbook, but I'm not finding any info about it in Google.

我依旧记得iPhone越狱的人已经找到了通过地址簿中有趣的URL或电话号码启动设置或其他应用程序的方法,但我没有在Google中找到任何关于它的信息。

:(

:(

3 个解决方案

#1


13  

As far as I know there's no sanctioned way to open Settings from another app.

据我所知,没有受到批准的方式从另一个应用程序打开设置。

In my opinion you should just ask for the values if you need them at launch, storing them in your NSUserDefaults and possibly directing your users to look in Settings.app if they need to change those settings in the future.

在我看来,如果您在启动时需要这些值,请将它们存储在NSUserDefaults中,如果需要在将来更改这些设置,可能会指示用户查看Settings.app。

Unfortunately that means maintaining some minimal UI for your user to fill in their settings during that first launch, but it seems better from a UX perspective to me than denying the user the joy of using the app immediately.

不幸的是,这意味着在第一次启动时为用户保留一些最小的UI来填充他们的设置,但从UX的角度来看,似乎比拒绝用户立即使用应用程序的乐趣更好。

#2


8  

In its current form, Settings is not really up to the task you want to use it for.

在当前形式中,“设置”并不完全取决于您要使用它的任务。

The problem you'll run into, if you haven't already, is that you'll want to verify the user's information somehow. Maybe they entered the server name wrong, or made a mistake in their password. What then? Keep sending the user back to Settings to try again, then switching back to your app to find out if they got it right this time? That's going to be a lousy user experience, and the best way to fix it is to give the user the option of changing the settings in your app so you can verify the information immediately.

如果您还没有遇到问题,那么您将需要以某种方式验证用户的信息。也许他们输错了服务器名称,或者他们的密码出错了。然后怎样呢?继续将用户发送回“设置”以重试,然后切换回您的应用以确定他们这次是否正确使用?这将是一个糟糕的用户体验,解决它的最佳方法是让用户选择更改应用程序中的设置,以便您可以立即验证信息。

Only once you've done that, poof, you don't need to use Settings for this anymore. You can just send users to that account-edit view immediately when your app launches for the first time. Your users get a better experience, and you're saved the trouble of trying to find a good way to get users to find your app's configuration in the Settings app.

只有你做完了,poof,你不再需要使用Settings了。当您的应用首次启动时,您可以立即将用户发送到该帐户编辑视图。您的用户可以获得更好的体验,并且您可以省去尝试找到一种让用户在“设置”应用中找到应用配置的好方法。

Apple does this already-- just look at mobile mail.

Apple已经这样做了 - 只看移动邮件。

#3


1  

One of possible solutions suggested above is to write own settings dialog. I have found this project http://www.inappsettingskit.com/ which you can include to your app and it shows the same settings as iOS does. I did not test it yet, but going to do now.

上面建议的一种可能的解决方案是编写自己的设置对话框。我找到了这个项目http://www.inappsettingskit.com/,您可以将其包含在您的应用程序中,它显示与iOS相同的设置。我还没有测试它,但现在要做。

#1


13  

As far as I know there's no sanctioned way to open Settings from another app.

据我所知,没有受到批准的方式从另一个应用程序打开设置。

In my opinion you should just ask for the values if you need them at launch, storing them in your NSUserDefaults and possibly directing your users to look in Settings.app if they need to change those settings in the future.

在我看来,如果您在启动时需要这些值,请将它们存储在NSUserDefaults中,如果需要在将来更改这些设置,可能会指示用户查看Settings.app。

Unfortunately that means maintaining some minimal UI for your user to fill in their settings during that first launch, but it seems better from a UX perspective to me than denying the user the joy of using the app immediately.

不幸的是,这意味着在第一次启动时为用户保留一些最小的UI来填充他们的设置,但从UX的角度来看,似乎比拒绝用户立即使用应用程序的乐趣更好。

#2


8  

In its current form, Settings is not really up to the task you want to use it for.

在当前形式中,“设置”并不完全取决于您要使用它的任务。

The problem you'll run into, if you haven't already, is that you'll want to verify the user's information somehow. Maybe they entered the server name wrong, or made a mistake in their password. What then? Keep sending the user back to Settings to try again, then switching back to your app to find out if they got it right this time? That's going to be a lousy user experience, and the best way to fix it is to give the user the option of changing the settings in your app so you can verify the information immediately.

如果您还没有遇到问题,那么您将需要以某种方式验证用户的信息。也许他们输错了服务器名称,或者他们的密码出错了。然后怎样呢?继续将用户发送回“设置”以重试,然后切换回您的应用以确定他们这次是否正确使用?这将是一个糟糕的用户体验,解决它的最佳方法是让用户选择更改应用程序中的设置,以便您可以立即验证信息。

Only once you've done that, poof, you don't need to use Settings for this anymore. You can just send users to that account-edit view immediately when your app launches for the first time. Your users get a better experience, and you're saved the trouble of trying to find a good way to get users to find your app's configuration in the Settings app.

只有你做完了,poof,你不再需要使用Settings了。当您的应用首次启动时,您可以立即将用户发送到该帐户编辑视图。您的用户可以获得更好的体验,并且您可以省去尝试找到一种让用户在“设置”应用中找到应用配置的好方法。

Apple does this already-- just look at mobile mail.

Apple已经这样做了 - 只看移动邮件。

#3


1  

One of possible solutions suggested above is to write own settings dialog. I have found this project http://www.inappsettingskit.com/ which you can include to your app and it shows the same settings as iOS does. I did not test it yet, but going to do now.

上面建议的一种可能的解决方案是编写自己的设置对话框。我找到了这个项目http://www.inappsettingskit.com/,您可以将其包含在您的应用程序中,它显示与iOS相同的设置。我还没有测试它,但现在要做。