I am building a Xamarin forms project and I use PCLAppConfig in the platform specific projects to get the app config file from the common project. This has been working until recently. Following an upgrade to Visual Studio(15.9.2) and the iOS OS(High Sierra 10.13.6) it stopped working for the iOS project (I have a feeling those changes are masking the real reason). I get the below error:
System.IO.FileNotFoundException: path: /private/var/containers/Bundle/Application/0AC8F626-E2BD-4432-AC13-C761A1C95E1C/DemoApp.iOS.app/DemoApp.iOS.exe.config
To me it looks like it cannot find app.config
My main project still has an app.config and in the iOS specific project I can see an App.config (with a linked file symbol). Should the iOS specific project linked config have different casing?
the code
global::Xamarin.Forms.Forms.Init();
ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);
LoadApplication(new App());
also tried
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
ConfigurationManager.AppSettings = new ConfigurationManager(assembly.GetManifestResourceStream("DemoApp.App.config"))
LoadApplication(new App());
Edit - further info
I have looked through the code base and in this case
PCLAppConfig.FileSystemStream.PortableStream.Current
is equivalent to
System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
hopefully that will help with getting an answer
Ran into the same issue.
Was fixed in 1.0.1.
Related
I am currently updating our company Mobile application which was created a year back. Recently when I update my project to MonoAndroid 9.0 and build the solution I was bombarded with many errors (attached). I tried to fix it by updating the nuget packages but after I update, Resource.Designer file has generated files with syntax errors like public const int bottomtab.navarea = 2130969385; where in Xamarin can't understand the "." in the above. I am also facing issues like
1. resource style/Widget.MaterialComponents.TextInputLayout.OutlinedBox (aka sg.totalebizsolutions.rocktree:style/Widget.MaterialComponents.TextInputLayout.OutlinedBox) not found. CSMobile.Droid
2. resource style/Theme.MaterialComponents.Light.DarkActionBar (aka sg.totalebizsolutions.rocktree:style/Theme.MaterialComponents.Light.DarkActionBar) not found. CSMobile.Droid
3. failed linking references. CSMobile.Droid
4. expected reference but got (raw string) #000000. CSMobile.Droid
I am not sure what am I missing here. Please find my csproj file attached
CSProjFile
From what I googled, I could not find solution.
UrhoSharp GIT, is solution built with VS2015.
I created new Xamarin mobile platform solution.
Copied the relevant files over from sample UrhoSharp project.
Then ran the Windows(UWP) propject. it crashes.
(I did it this way as there were too many issues with building the sample project that was created in VS2015)
protected Sample(ApplicationOptions options) : base(options) { }
Throws an exception.
System.Exception
HResult=0x80131500
Message=Implementation assembly (iOS, Android or Desktop) is not referenced
Source=UrhoSharp
at Urho.UrhoPlatformInitializer.DefaultInit()
Try to update to latest UrhoSharp package (1.9.67 at this moment), clean and rebuild the whole solution. It helped in my case.
I'm using an approach described here for my app.
Currently, I was able to setup such structure for Android and iOS platforms. In general, I have the global core (.NET lib), platform specific core (platform specific Class Library), and some extension (platform specific Class Library).
The problem appears when I try to configure in same way structure for macOS platform. I was able to create platform specific class Library with components that should be reused in apps (for now this is just 1 class with the xib file). But, when I want to use this package in macOS target I got runtime error specific to macOS platform:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[NSNib _initWithNibNamed:bundle:options: ] could not load the nibName: MainView in bundle (null).'
That's strange, because I set up in same way structure for iOS app, and within the iOS target, it's work just great: all source files, xib files, resources are visible and could be freely used from the package.
Note:
I found few issues like described above and some solutions that could resolve this blocking point:
rename xib file - doesn't work
put xib file in rootDir - doesn't work
make sure that BuildAction for file is "InterfaceDefinition" - doesn't work (it always set to InterfaceDefinition)
recreate files - doesn't work
clean all, remove file, reboot, create new - doesn't work
put files in resource dir - doesn't work
force include into package - doesn't work
check that class in VB is correct - doesn't work (was always correct)
check Xcode folder with autogenerated files - doesn't work (in general all files was always there, few times autogenerated h and m files were missed -> I receive another error, but when manually create them -> I faced again with such error)
manually specify bundle for resource - doesn't work (this is strange because for iOS lib all resources are available within the null (main) bundle) - I try to explicitly specify bundle - doesn't work.
So, how to prepare class library within some source files, xib, other resources, so it can be freely accessed from any project that uses this package? Or maybe some steps described above was incorrect?
According to Chris Hamonds from Xamarin Forum here is the answer:
I believe this is a bug we've fixed but is not in the latest builds in our channel. I can reproduce with our Alpha build but installing a build from: https://jenkins.mono-project.com/view/Xamarin.MaciOS/job/xamarin-macios-builds-master/
I created a Xamarin iOS binding project that requires the following frameworks:
SystemConfiguration.framework
CoreTelephony.framework
libz.dylib
libsqlite3.dylib
I added the following line in my iOS binding project to the linkwith.cs file:
Frameworks = "SystemConfiguration CoreTelephony"
This seems to work correctly and tells that project to include these frameworks when binding. From what I have read, it sounds like the remaining 2 libraries need to be added as linker flags in the project referring to the DLL generated from my iOS binding project. So I created a test app, imported the DLL, and now need to add the linker flags but my project cannot find the right libraries.
My linker flags in Xamarin Studio are as follows:
-gcc_flags "-lz -lsqlite3.0"
When I build my Xamarin test app I get a few errors regarding the frameworks that cannot be found. Are there additional flags that need to be linked or do I need to do some additional configuration in my iOS binding project?
I found a great resource: http://ipixels.net/blog/specify-extra-gcc-flags-for-native-library-binding-in-xamarin-ios/
I needed to add LinkerFlags = "-lz -lsqlite3.0" to my .linkwith.cs file. I then rebuilt the library to generate a new DLL and added this to my test app. The test app builds correctly then.
If you are creating your bindings for a cocoapod using sharpie:
sharpie pod init ios nameOfCocoaPod
sharpie pod bind
you get a nameOfCocoaPod.framework file and .cs-binding files.
The nameOfCocoaPod.framework file should be added to your binding project under Native References. To change e.g. Frameworks or LinkerFlags, right-click and open properties.
I am unable to compile the Glympse API for iOS due to 4 duplicate symbol errors in the framework. Like the example projects, I only import the GlympseLite.h header in my .pch file. Is anyone else having this issue?
One of the duplicate symbols is: __ZN7Glympse15ControlsFactory9showAboutERKNS_1OINS_12IGlympseLiteEEERKNS1_INS_8IGlympseEEE
How did you add GlympseKitLite into your project? Could you provide exact steps.
Which XCode version are you using?
Is there anything special about compiler/linker flags in your project?
Is it brand new or existing project?
Were you able to build sample projects provided with SDK?
I just confirmed that it compiles fine in a brand new projects. Here are the steps I followed:
Created new iOS project.
Dragged GlympseKitLite.embeddedframework (from SDK package) to Frameworks.
Added all required standard frameworks (CFNetwork, libz, CoreLocation, AddressBook, Security, EventKit, MapKit, MessageUI).
Added import entry to PCH file.
Called Glympse::LiteFactory::createGlympse(...);
In the mean time you can try the following. Set C Language Dialect, C++ Language Dialect and C++ Standard Library to Compiler Default. Let me know, if it helps.