错误CS0246:类型或名称空间名称' uikit'做CI构建时找不到
Uikit将在我的解决方案中的iOS项目中构建我的CI构建,但不会在我的共同项目中构建, 在此处输入图像描述
它给了我上面指出的错误。任何想法为什么。我需要在iPone上执行警报,因为app.current.mainpage.displayalert和popupNavigation.instance.pushasync(new Popuppage());利用RG.Plugins.popup.pages.popuppage无法正常工作,但是我知道Uikit工作中的警报,因为它们可以使用我拥有的另一个iOS应用程序。
哦,顺便说一句,这是在本地构建的,只是在我的CI构建上不是
我的CI构建的YAML,这是非常基本的
步骤: - 任务:Xamarinios@2 DisplayName:“构建解决方案” 输入: SolutionFile:mileagemanagerforms.sln 配置:“临时” 干净:是的 WorkingDirectory:mileagemanagerforms/mileagemanagerforms.ios
UIKit will build in my CI build in my IOS project in my solution but will not build in my common project noted here,
enter image description here
it gives me the error noted above. Any idea why. I need this to do alerts on my ipone because the App.Current.MainPage.DisplayAlert and the PopupNavigation.Instance.PushAsync(new PopupPage()); utilizing the Rg.Plugins.Popup.Pages.PopupPage are not working, but I know the alerts in the UIKit work as they work on another IOS app that I have.
Oh, and by the way, this builds locally, just not on my CI build
Here is my yaml for the CI build, very basic
steps:
- task: XamariniOS@2
displayName: 'Build Solution '
inputs:
solutionFile: MileageManagerForms.sln
configuration: 'Ad-Hoc'
clean: true
workingDirectory: MileageManagerForms/MileageManagerForms.iOS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您添加了
Uikit
汇编正确参考。per
”或找不到程序中使用的名称空间。您可能已经忘记参考包含类型的程序集( - 参考),或者您可能没有使用指令添加所需的内容。或者,您要引用的组件可能存在问题。
使用uialertControllerStyle指示要显示的警报的类型。这些警报类型是:
显示简单警报的代码如下:
参考链接: https://learn.microsoft.com/en-us/xamarin/ os/ oser/user-interface/controls/controls/alerts/alerts/alerts
更新:
有一个解决方法可以使用 /a>在iOS项目上设置警报。
1.在我们的共享软件包中创建界面。
2.在iOS项目中,我们应该实施它。
您可以在我们项目的任何地方获得警报服务。
Make sure you have added
UIKit
assembly reference correctly.Per Microsoft docs :
A type or namespace that is used in the program was not found. You might have forgotten to reference (-reference) the assembly that contains the type, or you might not have added the required using directive. Or, there might be an issue with the assembly you are trying to reference.
Use UIAlertControllerStyle to indicate the type of alert to display.These alerts types are:
The code to display a simple alert is as follows:
Reference link: https://learn.microsoft.com/en-us/xamarin/ios/user-interface/controls/alerts
Update:
There is a workaround that use dependency service to set the alert on the iOS project.
1.Create an interface in our shared package.
2.In iOS project,we should implement it.
The you can get the alert service in anywhere in our project.