如何使用wkwebview打开PDF链接(How to open a Link to a PDF with wkwebview)
我创建了一个简单的iOS应用程序,它使用WKWebView打开一个URL。 进入网站的网站,有一个PDF文档的链接。 当我在浏览器中打开网站时,我可以点击链接,然后打开PDF文档。 但在我的应用程序中,当我点击链接时没有任何反应。 我该如何解决? 我是否必须在info.plist中添加一些内容?
感谢帮助。
I created a simple iOS App, which opens a URL with WKWebView. Into website the site, there is a link to a PDF Document. When I open the site into my browser, I can click onto the Link, and the PDF document opens. But into my App, nothing happens, when I click onto the link. How can I fix it? Do I have to put something into my info.plist?
Thanks for help.
原文:https://stackoverflow.com/questions/47754252
最满意答案
清理项目( Build> Clean )并确保正确安装所有sdk软件包。
Clean your project (Build>Clean) and make sure all sdk packages installed correctly.
相关问答
更多-
如何使用AndroidInjector获取模块内的MainActivity(How to get MainActivity inside a module using AndroidInjector)[2023-11-02]
在我的设置中,我在我的ui/包中的sub-di-packages的根目录下有一个di/ ui/ package。 在ui/di包中,我声明了以下模块和组件: @dagger.Module public class MainActivityModule { @Provides FragmentManager provideFragmentManager(MainActivity mainActivity) { return mainActivity.getSupportFragmentMa ... -
清理项目( Build> Clean )并确保正确安装所有sdk软件包。 Clean your project (Build>Clean) and make sure all sdk packages installed correctly.
-
findPreference是一个方法,它是PreferenceFragment和PreferenceActivity - 这些是实际显示您的Preference屏幕的片段/活动(该活动已弃用,您应该使用PreferenceFragment )。 您正尝试在MainActivity使用它。 这不起作用,因为Preference对象实际上并不存在于此屏幕上(它们存在于另一个通常具有PreferenceFragment作为其一部分的活动中)。 如果您需要在不是您的首选项屏幕的活动中访问首选项的首选项值,请使用S ...
-
你需要改变 setContentView(R.layout.MainActivity); 至 setContentView(R.layout.activity_main); 假设您有一个名为activity_main.xml的布局,而不是MainActivity ,它实际上是您的Activity类的名称 和删除 import android.R.*; 并导入 import com.example.testing.R; You need to change setContentView( ...
-
我认为你可以用putExtra使用Intent startService(new Intent(this,MainActivity.class).putExtra("Key","Data)); 或CallBack模式检查这个答案 Android中的回调是什么? I figured out how to complete the task successfully and simply. The code that I already had for the GeofenceTransitionServic ...
-
这是由于以下原因之一: 1)您在名称中命名了一个TextView ,如R.id.imageView2 ,因此您的findViewById()方法返回它并且无法将其转换为ImageView (这是逻辑的) 2)你的项目中有另一个R.id.imageView2 ,它是一个TextView ,同样在这里。 请记住, id在您的项目中不必是唯一的,但这样的事情可能会发生。 It's due to one of those reasons: 1) Either you named a TextView within ...
-
对于findViewById调用,您需要对片段xml进行膨胀,并使用返回的视图来“查找”您的视图。 @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); ...
-
MainActivity必须实现OnFragmentInteractionListener(MainActivity must implement OnFragmentInteractionListener)[2022-02-20]
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, OnFragmentInteractionListener { ....... } 按Alt +在OnFragmentInteractionListener上输入以在OnFragmentInteractionListener中导入它 publi ... -
首先,如果有一行名为import android R; ,删除该行。 接下来,这样做: 单击“项目”,向下滚动,然后单击“清理”以清理项目。 通过再次单击“项目”重建项目,向下滚动单击“全部构建”。 我假设你正在使用Eclipse。 Firstly, if there is a line called import android R; , delete that line. Next, do this: Clean your project by clicking Project, scroll down ...
-
哪里声明了适配器变量? 据我所知,它被声明为片段中的实例变量,而MainActivity是另一个类。 在这种情况下,您应该能够直接使用它: adapter.getFilter().filter(cs); Where adapter variable is declared? As far as I understood it is declared as an instance variable within your fragment, while MainActivity is another clas ...