-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the textview will crash app #15
Comments
Can you show me your code? |
Sure, here is the code that crash app in simulator
…-----------------------------------------------------------
@State private var isEditing:Bool = true
@State private var str_title: String = “"
@State private var str_content: String = “"
var body: some View {
VStack(alignment:.leading){
Text("Title").lineSpacing(10).padding(10)
TextField("Placeholder", text: $str_title)
.onAppear{
self.str_title = “test title."
}
.textFieldStyle(RoundedBorderTextFieldStyle())
.autocapitalization(.none)
.font(.system(size: 20))
.lineSpacing(10)
.padding(10)
Text("Detail").lineSpacing(10).padding(10)
TextView(
text: $str_content,
isEditing: $isEditing,
placeholder: ""
).onAppear{
self.str_content = “hello, test"
}
}.frame(height: 100)
//there are some other code like Button Click action
}
————————————————————————————
The result was : ” Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)”
I used swiftUI, Xcode 11.4
In other view, I use almost same code and it is working fine. The app was crash when presented to this view. It took me half day to figure out it was the textview because I can’t locate the detail line and I didn’t expect it was textview, everything will work fine if I disable textview or replace textfield with textview. And I was disable other code in the same view first and still crash until I disable textview.
Hope it will help.
Thanks
Michael
On Apr 21, 2020, at 6:54 PM, Ken Mueller ***@***.***> wrote:
Can you show me your code?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKP7XHIBICVSFIPNBRWL7G3RNZE37ANCNFSM4MNWMEUA>.
|
Hmm... Try removing the |
I did, and it still crash .
I guess two reason:
1: presented
2: two textview in same app
Thanks
Michael
… On Apr 22, 2020, at 3:03 PM, Ken Mueller ***@***.***> wrote:
Hmm... Try removing the .onAppear on the TextView.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKP7XHIG77WRWEPHLJOHALTRN5SUPANCNFSM4MNWMEUA>.
|
I don't see two |
The code of the other view is almost same
——————————
TextView(
text: $str_content,
isEditing: $isEditing,
placeholder: messageinfo.messagecontent
).onAppear{
self.str_content = self.messageinfo.messagecontent
}.frame(height: 100)
—————————---
But the view never cause crash, and this view was show by NavigationLink
Thanks
Michael
… On Apr 23, 2020, at 1:10 AM, Ken Mueller ***@***.***> wrote:
I don't see two TextViews in that view. If you could share your repository I could take a look and see what the issue is.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKP7XHKKC52A7ND2K35CQATRN7ZW5ANCNFSM4MNWMEUA>.
|
In my App-Store-available app, two TextViews in the same view works fine. |
It works!!! Thank you so much!
Do you mind tell me more detail about why it crash app when two textviews or more textviews ?
Thanks
Michael
… On May 13, 2020, at 5:48 AM, Shibo Lyu ***@***.***> wrote:
In my App-Store-available app, two TextViews in the same view works fine.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKP7XHJKW4BMXQVC6YD2PCDRRKJLRANCNFSM4MNWMEUA>.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I placed two textviews in two different view, and somehow one of textview is fine, but the other one will crash app when open the view.
The text was updated successfully, but these errors were encountered: