SwiftUI - String function size(withAttributes:) throwing NSInvalidArgumentException - swiftui

The following code is throwing this exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__SwiftValue renderingMode]:
unrecognized selector sent to instance 0x6000007122b0'
let helloWorld = "Hello World"
let width = helloWorld.size(withAttributes: [.font: Font.system(size: 16.0)])
print("\(width)")
Has anyone figured out why this isn't working or a potential workaround? This is happening in Swift 5 targeting iOS 13.2

The structure Font is different from the class UIFont. The following works.
let width = helloWorld.size(withAttributes: [.font: UIFont.systemFont(ofSize: 16.0)])

Related

0x800a138f - JavaScript runtime error: Unable to get property 'getRandomValues' of undefined or null reference in powerbi.js and powerbi.min.js

I am embedding a PowerBI report in IE using ExtJS .Net, but I am receiving the following console error:
"Unhandled exception at line 6, column 1859 in http://localhost:55020/scripts/powerbi.min.js
0x800a138f - JavaScript runtime error: Unable to get property 'getRandomValues' of undefined or null reference"
function getRandomValue() {
// window.msCrypto for IE
var cryptoObj = window.crypto || window.msCrypto;
var randomValueArray = new Uint32Array(1);
cryptoObj.getRandomValues(randomValueArray);
return randomValueArray[0];
}
powerbi-client version 2.10.3
getRandomValues is a method of window.msCrypto object in IE11, but it is not supported in IE9.
powerbi-client library works fine with IE11.
Refer this: https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto#Browser_compatibility

App crash when I'm trying to updating an app when returning from background in iOS using swift 3

I'm using this code in viewdidload()
NotificationCenter.default.addObserver(self, selector: Selector(("appWillEnterForeground:")), name: NSNotification.Name.UIApplicationDidBecomeActive, object: UIApplication.shared)
that call this function
func appWillEnterForeground(notification: NSNotification!) {
// update label text here
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(true)
NotificationCenter.default.removeObserver(self)
}
but that app crash when it back to the foreground
unrecognized selector sent to instance 0x160db800
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ appWillEnterForeground:]: unrecognized selector sent to instance 0x160db800'
appWillEnterForeground: tells the notification center to look for a method with that name, but which takes one parameter. Your implementation of the method takes no parameters and therefore isn't seen as a correct match.
Try Selector(("appWillEnterForeground").

Swift 3. Argument Labels do not match error

I have just upgraded to Swift 3 and get an error on the following code that is within a UITableViewController.
The code is return segue from a form, and is intended to refresh the table inserting the new entry from the form. This worked fine on 2.2, and I have changed NSIndexPath to IndexPath
#IBAction func saveTripFormViewList(segue:UIStoryboardSegue){
trips = uiRealm.objects(Trip.self)
let indexPath = IndexPath(forRow: trips!.count - 1, inSection: 0)
tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
The error I get is
Argument labels '(forRow:, inSection:)' do not match any available overloads
Any advice on how to resolve the error
In Swift 3 it's just IndexPath(row:section:).
FYI, IndexPath is a new value type (a struct) that does the same job as NSIndexPath (a class). (NSIndexPath's initializer has changed as well.) Also, I believe they're toll-free bridged, but don't quote me on that.

cassandraunit throws Dataset not found error

I am using cassandra-unit 3.0.0.1 from here but it is throwing dataset not found error
#Rule
public CassandraCQLUnit cassProvider = new CassandraCQLUnit(new ClassPathCQLDataSet("simple.cql","keyspaceNameToCreate"));
is there any other plugins i need to use or is it a bug in cassandra-unit?
EDITED
I have run my test in debug mode and found that the getInputDataSetLocation is returning null for me in ClassPathCQLDataSet.java
protected InputStream getInputDataSetLocation(String dataSetLocation) { //dataSetLocation: "simple.sql"
InputStream inputDataSetLocation = this.getClass().getResourceAsStream("/" + dataSetLocation); // inputDataSetLocation: null
//when i run test for cassandraunit-example app i get BufferedInputStream#924 but I am getting null here which is causing error
return inputDataSetLocation;
}
Please let me know if i am missing anything here. Thanks a ton

llbd error on Xcode 4.6

I am making a Website Picker App on Xcode 4.6 and there are no issues except when I try to run it I get send to the debugger with an error.
return UIApplicationMain(argc, argv, nil, NSStringFromClass([Website_PickerAppDelegate class]));
^^This is highlighted in green with Thread 1: signal SIGABRT under it.
It also has:
2013-06-06 23:29:53.698 Website Picker[1185:c07] -[Website_PickerViewController pickerView:numberOfRowsInComponent:]: unrecognized selector sent to instance 0x75614f0
2013-06-06 23:29:53.699 Website Picker[1185:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Website_PickerViewController pickerView:numberOfRowsInComponent:]: unrecognized selector sent to instance 0x75614f0'
*** First throw call stack:
(0x1c92012 0x10cfe7e 0x1d1d4bd 0x1c81bbc 0x1c8194e 0xc691 0xf41a 0x1f8548 0x1fb224 0xbf952
0xbf2dc 0xdff8 0x642dd 0x10e36b0 0x228efc0 0x228333c 0x228eeaf 0x1032bd 0x4bb56 0x4a66f 0x4a589
0x497e4 0x4961e 0x4a3d9 0x4d2d2 0xf799c 0x44574 0x4476f 0x44905 0x4d917 0x234b 0x11157 0x11747
0x1294b 0x23cb5 0x24beb 0x16698 0x1beddf9 0x1bedad0 0x1c07bf5 0x1c07962 0x1c38bb6 0x1c37f44
0x1c37e1b 0x1217a 0x13ffc 0x2052 0x1f85)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Can someone please tell me what is the problem ?
Thank You!
The problem probably exists because Website_PickerAppDelegate is the class name and not the variable name, unless you capitalize your variable names. It needs to be something like
return UIApplicationMain(argc, argv, nil, NSStringFromClass([pickerAppDeligateVar class]));
Of course replace pickerAppDeligateVar with the appropriate variable name and give it a go.
The error message
-[Website_PickerViewController pickerView:numberOfRowsInComponent:]: unrecognized selector sent to instance 0x75614f0
means that you did not implement the
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
method in the Website_PickerViewController that acts as data source for the picker view.
(If you think that you implemented it: Check for typing errors such as upper/lower case
letters in the method name.)