I'm a beginner in programming world and I choose "Swift" to be my first programming language. Everything so far went great but now I'm learning about structures and instances, how to update them and so on and I'm getting mysterious console error and I can not move further with my project.
So problem.
I created struct called "Tiger.swift". There is properties for that struct such as name, age, etc. In "viewController" I created new variable called myTiger and tried to update it properties and after my created println command in console appears something strange. It compiles and tells me that "build was succesfully" but in console appears something like this.
"My Tiger's name is: Tigger, it's age is 3, it's age is 3 and it's image is Optional()"
And this strange thing is "Optional". Because if I later want to update my instances it does not compiles and shows me :
"My Tiger's name is: Tigger, it's age is 3, it's age is 3 and it's image is Optional()
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb) "
There is a link to Git repository ( https://github.com/llinards/lionsandtigers ) in case there isn't a quick solution or a little bug which accidentally I have made.
I would appreciate any help from you!
Thanks!
I took a closer look at your code:
I changed the image property of your Tiger struct to be optional because you don't have a template or placeholder image (if you have one you can set the initial value to that image).
Your storyboard (including your IBOutlets) very pretty screwed up ... I don't know how that happened, I have never seen anything like this before ...
I uploaded a working copy of you project here (It's hard to show that IB-related stuff here, I just deleted and re-added your labels and views).
The relevant code changes I did are the following:
In your Tiger model object (Tiger.swift) I changed the last line from
var image = UIImage(named:"")
to
var image: UIImage?
The first error you encountered was because UUImage(named:"") returns nil. In Swift a non-optional type must never ever be nil.
In your ViewController a changed the Tiger-initializtion to
Tiger(age: 3, name: "Tigger", breed: "TOne", image: UIImage(named: "t1.jpg"))
Your println() call shows:
My Tiger's name is: Tigger, it's age is 3, it's age is 3 and it's image is Optional(UIImage: 0x7f8d78f43c90)
This is correct since your image is now wrapped into an optional.
Related
I am building an app in SwiftUI and I've encountered a confusing error:
CrashReportError: Preview is missing environment object "TabViewModel"
Mathematically crashed due to missing environment of type: TabViewModel. To resolve this add `.environmentObject(TabViewModel(...))` to the appropriate preview.
It's asking me to insert the modifier but doesn't mention where to put it.
This happened when I used this modifier down in my code.
.overlay(PGDetailView(animation: animation).environmentObject(tabData))
*Note: 'tabData' is used here: #EnvironmentObject var tabData: TabViewModel
can you help me to convert this to python 3.5 ? I tried but it don't work. I did the following steps:
I change the package md5 to hashlib
I change all the id = md5.new("%s"%str(clf.get_params())).hexdigest() to id = hashlib.md5(("%s"%str(clf.get_params())).encode('utf-8') ).hexdigest()
but I still have somme problems when I put a directory to these parameters
save_preds="",
save_params=""
save_test_only=""
clf_name="XX"
I have the folowing error when I put something in thise parameters:
TypeError: a bytes-like object is required, not 'str'
Please see the code here:
blend_proba.py
Thanks,
cdk
Replacing
clf_name="XX"
by
clf_name=b"XX"
would convert the strings into objects of type bytes. Whether those changes will be enough, I honestly have no idea.
I'm using this code to loop columns of a SharePoint 2013 List.
currentContext.Load(currentList.Fields);
currentContext.ExecuteQuery();
foreach (Field f in currentList.Fields) {
}
No problem with normal columns. But, when I arrive to a lookup column I have this error:
"Unable to cast object of type
'System.Collections.Generic.Dictionary`2[System.String,System.Object]'
to type 'Microsoft.SharePoint.Client.Field'."
I found for example this discussion
This issue came when we were working with TaxonomyFieldValue fields. For us changing references was not an option. This helped:
TaxonomyItem dummy = new TaxonomyItem(web.Context, null);
It will force program to load adequate libraries forcing correct type in runtime.
I had this same issue and updating the references fixed it for me. This question helped me figure it out.
I went from version 14 of "Microsoft.SharePoint.Client" and "Microsoft.SharePoint.Client.Runtime" to version 16 and no longer had the error.
Latest client download
I am using the wave audio component in my project and I run into a problem that I am unable to resolve.
I am using Delphi XE 5 and my operating system is Windows 8. When I am trying to the run the project and active the liveaudio recorder on Windows 7, I got this: error Exception EOSError in module Chatproject.exe at 00029633. System Error. Code: 123. The filename, directory name, or volume label syntax is incorrect. But its working normal on Windows 8,. I tried to debug and figure out the problem I got this error message when I am activating the recorder
Update of the question :
i debugged each of sendtocl , sendbuffer ,buffer^, buffersize and here is result in the image ,, but i have no idea how to fix sendbuffer and buffer^ and sendtocl
http://i.stack.imgur.com/5sZ05.jpg
You have four references to sendtocl:
#56: sendtocl: TIdUDPClient;
#235: if sendtocl.active then
#236: sendtocl.SendBuffer(RawToBytes(Buffer^, Buffersize))
#260: sendtocl.Broadcast(usertype.Text, 12000);
It should be getting created when the form is created, assuming it's a component dropped on the form. But for whatever reason, it isn't instantiated at some point.
This is consistent with the exception message you're getting.
The ERROR_INVALID_NAME is probably pointing to an invalid URI, path, or filename -- it's entirely possible that it's valid in Win 8 but not Win 7. So when you try to invoke .Active, it fails. But why sendtocl woudl be set to NIL doesn't make sense. Mabye the exception is on the SendBuffer method?
As Ken suggests, you just need to go in with the debugger and figure out what's going on. I'm not sure there's much more us "out here" can do for you other than comment on how the code appears.
local scaling = Application.CENTER
application:setScaleMode(scaling)
I tried using above code in Gideros but it gives an error that 'bad argument #1 to 'setScaleMode' (string expected, got nil) at setScaleMode, how can I fix this ?Actually, It did not recognise Application.CENTER , though according to Apress Lua game development, It should.
It seems that the constants are not set (probably a bug), but you can still use the values from here:
http://docs.giderosmobile.com/reference/gideros/Application/setScaleMode#Application:setScaleMode
As application:setScaleMode("center")
But you can also set the value in the Gideros Studio project properties