ASSERTION FAILURE in IBUIColor.m - Xamarin.iOS - xcode

All of a sudden my Xamarin iOS project is not building. My last commited version of the Storyboard is working, but any slight change in the file producing the following errors.
MainController.storyboard : error : 2019-11-19 19:53:33.159 ibtoold[9510:345883] [MT] DVTAssertions: ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-15505/InterfaceBuilderKit/ImageCatalog/Library/IBUIColor.m:105
MainController.storyboard : error : Details: nsColor should be an instance inheriting from NSColor, but it is IBUIColor
MainController.storyboard : error : Object: <IBUIColor: 0x7fd6420a5290>
MainController.storyboard : error : Method: -initWithNSColor:
Here is the full log: https://del.dog/obapeletof
Here is full xcode crash log: https://del.dog/oyibarutoc
If I try to open the file in xcode, it's producing the same error & crashing xcode.
I'm really clueless now what causing the errors. I have tried searching the Storyboard in xml format for nscolor, there is none!

Xamarin iOS designer for some reason removing my below custom color asset from the StoryBoard resources
<namedColor name="lightdarkcolor">
<color colorSpace="custom" customColorSpace="sRGB" red="0" green="0" blue="0" alpha="1" />
</namedColor>
I had to manually add this to storyboard code behind.
And it seems xamarin ios designer is doing this with color assets for every project(Maybe after recent update).

Related

Error when clicking any UI element in Xamarin.iOS

I have an issue with an iOS app I'm working on (https://github.com/nodoid/WeatherApp). It builds and deploys fine but when you hit any UI element that isn't a label, it crashes with an error such as
ViewController btnGetWeather unrecognised selector sent to instance
Error: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: ViewController btnGetWeather unrecognised selector sent to instance
It's been a long time since I've done anything with iOS native (I was still using xibs!). It looks like everything is correct on the storyboard but I'm at a loss as to why this is happening given everything builds.
I've done the usual trick of deleting the obj folder in the iOS project, but still get this issue.
I downloaded your code to try it out. When I click the button, the error message :Name: NSInvalidArgumentException Reason: Application tried to present modal view controller on itself. Presenting controller is <UIAlertController: 0x7fb648008a00>.
I found the reason for this problem: In the ShowError method of your ViewController.cs, you use the alert.PresentViewController() method, you need to change the alert of this line of code to "this.PresentViewController()".

Safari extension builded with Xcode, disappears from Safari after rebuild

I'm trying to build a Safari extension using Xcode, using this manual: https://developer.apple.com/documentation/safariservices/safari_app_extensions/building_a_safari_app_extension
The first time it builds fine and actually works, however if I want to rebuild it after changes, the extension disappears from Safari.
Here're Few parameters I'm using:
Xcode app is build on Cacoa App template
App contains a Safari Extension target
Safari Allowed Unsigned Extension is checked
Console is throwing the following errors:
plug-in <private> pre-screen sees activating state
Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named ext.demo.Extension" UserInfo={NSDebugDescription=connection to service named ext.demo.Extension}
PlugInKit error in beginUsing: with plugin identifier: <private>, killing plugin
I guess I am missing something important here...
Do a Clean Build Folder under the Product menu - or - Shift-Command-K before you run it again, and you should be good to go!

XCode 8.3 , Unable to open Storyboard. It opens on XCode 8.2.1 though

Updated my machine to El Capitan
XCode 8.3 is not opening one storyboard from my project storyboards
XCode 8.2.1 is opening that storyboard
I am getting following errors
(null): Did not find storyboard named "Wall" referenced from Main.storyboard
could not read data from '/Users/Xxx/Library/Developer/Xcode/DerivedData/SikkaNet2-gaworyaefclfxpbfdbykpadvzxcu/Build/Intermediates/SikkaNet2.build/Debug-AWS-UAT-SIKKA-PROD-iphonesimulator/SikkaNet2.build/Wall-SBPartialInfo.plist': The file “Wall-SBPartialInfo.plist” couldn’t be opened because there is no such file.
Exception raised while unarchiving document objects - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects
/* com.apple.ibtool.errors */
/Users/XXX/Desktop/Code/XXX/View/Wall/Wall.storyboard: error: The document "Wall.storyboard" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)
Recovery Suggestion: Check the console log for additional information.
It seems like an issue of xcode 8.3, thank's apple for this. to fix it, create new group and move *.storyboard && *.xib to it.

VS 2015 Xamarin - Can't use iOS storyboard designer after running in debug/simulator

I started a new, empty Xamarin iOS project. When I edit the Main.storyboard, the designer pops up, no problem. But once I run the iOS simulator I can no longer edit the storyboard without error. It doesn't matter if I stop debug, detach from the simulator, close the storyboard and reopen; I have to completely close Visual Studio (2015) and reopen the solution in order to get the storyboard designer to render so I can work with it.
I'm on stable branch. Any ideas? Here's the error I get:
ERROR: EnsureSession (counter 1): MonoTouch.Design.Client.InvalidSessionException: Session invalid
at MonoTouch.Design.Client.ServerProcessConnection.SendRequest(CommandRequest req, Boolean throwIfNotRunning)
at MonoTouch.Design.Client.ServerProcessConnection.PostXml(DesignSession session, String xml, String[] viewsToHide)
at MonoTouch.Design.Client.ServerProcessConnection.PostXml(DesignSession session, XElement fullStoryboard, XElement[] partialElements, Boolean freezeMisplacements, String[] viewsToHide)
at MonoTouch.Design.Client.IPhoneDesignerSession.<>c__DisplayClass162_0.b__0(ServerProcessConnection c)
at MonoTouch.Design.Client.IPhoneDesignerSession.<>c__DisplayClass237_1`1.b__0()
[2016-08-31 00:10:13.6] INFO: Reloading: Serialization took 0ms
[2016-08-31 00:10:13.9] WARN: Failure #1 (IOException) while sending web request. Retrying..
[2016-08-31 00:10:13.9] INFO: Reloading: Serialization took 0ms
[2016-08-31 00:10:14.7] WARN: Failure #2 (IOException) while sending web request. Retrying..
[2016-08-31 00:10:14.7] INFO: Reloading: Serialization took 0ms
[2016-08-31 00:10:14.9] ERROR: Unrecoverable IOException.. Spin up attempts: 0, failure retries: 3
System.IO.EndOfStreamException: We could not fully deserialize the response ---> System.Runtime.Serialization.SerializationException: Attempting to deserialize an empty stream.
Edit: The only workaround I've found is to disconnect from the Mac Agent, close the designer, then reopen the designer which prompts you to reconnect to the Mac Agent. It's a tad faster than just closing VS entirely but not ideal.
Your workaround didn't work for me. My error was certainly different.
If you get this error you can take a look on log into:
C:\Users{USER}\AppData\Local\Xamarin\Logs\14.0
In this file I add a more detailed error why my storyboard didn't opened:
Xamarin.Messaging.Client.MessagingClient Error: 0 : [2016-12-27
15:27:39.5593] An error occured on the receiver while executing a post
for topic xvs/Designer/4.2.2.6/send-payload and client vs130
Xamarin.Messaging.Exceptions.MessagingRemoteException: An error
occured on client Designer4226 while executing a reply for topic
xvs/Designer/4.2.2.6/send-payload ---> System.NotSupportedException:
Couldn't find a DeviceConfig for [ConnectionAttributes: Device=Pad,
SdkPath=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk,
SdkVersion=10.1, ViewAs=Default]
Decoding this error is easier. It seems that my project was build for iOS 10.1 and my Xcode had only iOS 10.2 installed.
I opened Xcode and went into simulator and created a new device with iOS 10.1 simulator.
Closing the storyboard and opening it back and all was working as expected

Debug view hierarchy in Xcode 7.3 fails

This function fails with runtime error:
-[UIWindow viewForFirstBaselineLayout]: unrecognized selector sent to instance 0x7fb9dae257d0
Anybody encountered the same?
UPD:
Fails on simulator iOS 8.1/8.4. 9.3 works fine.
UPD2:
UIWindow is created like:
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = RootViewController.rootVC
window?.makeKeyAndVisible()
I got the view debugger working again by placing the following fix in my project:
#ifdef DEBUG
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
#implementation UIView (FixViewDebugging)
+ (void)load
{
Method original = class_getInstanceMethod(self, #selector(viewForBaselineLayout));
class_addMethod(self, #selector(viewForFirstBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original));
class_addMethod(self, #selector(viewForLastBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original));
}
#end
#endif
When your project loads, the load method will execute, causing viewForFirstBaselineLayout and viewForLastBaselineLayout to use the viewForBaselineLayout implementation if they are not currently implemented, so view debugging gets iOS8 flavor the behavior it was looking for.
To add this to your own project, create a new empty Objective-C file in your project and paste the contents in. You can name it whatever you want. I call mine "UIView+FixViewDebugging". If you are in a pure Swift project you do not need to create a bridging header. The file will be compiled into your project and you don't need to reference it.
Note this will only work for debug builds because of the #ifdef DEBUG. You can remove it but then you may accidentally compile this into your release builds (though it should have no ill side effects). If this method isn't working with these lines, check that your target has DEBUG=1 in Build Settings > Apple LLVM - Preprocessing > Preprocessor Macros > Debug.
Looks like Xcode 7.3 uses viewForFirstBaselineLayout property to draw the UI. But this property is marked as available since iOS 9.0.
[UIView viewForFirstBaselineLayout] method should be used for the version prior to iOS 9.0. It seems the guys from Apple didn't consider this case.
Yes. when click the debug view hierarchy button ,the page has nothing, and print "[UIWindow viewForFirstBaselineLayout]: unrecognized selector sent to instance 0x7fb9dae257d0" .
To solved it, just be sure you are using the iOS systom not below iOS 9.0 and you will still use that function freely.

Resources