1

I'm using FXRegistry to store the username and password, so that I can authenticate with my web service. When a user logs in, the username and password get written to the FXRegistry, and everything seems great. But when I exit out of the application and run it again, it doesn't seem to be able to ready from FXRegistry. I'm not sure what I'm doing wrong.

Here's the code,

regis = FXRegistry.new(APP_KEY, VENDOR_KEY)
regis.writeStringEntry("USER_CACHE", "username", usrTextField.text)
regis.writeStringEntry("USER_CACHE", "password", pwdTextField.text)

And here's how I read from it,

regis.readStringEntry("USER_CACHE", "username")
regis.readStringEntry("USER_CACHE", "password")
4

1 に答える 1

2

それで、完璧に見えるコードが機能しない理由がついにわかりました。それはすべて、アプリを終了する適切な方法に関係していました。通常の「exit」コマンドを使用して終了しましたが、FXRegistryのドキュメントには、「FXApp::init() が呼び出されたときにレジストリが読み取られ、FXApp::exit( ) と呼ばれます。

その方法がわからない人のために、ここにその方法を示します。

getApp().exit(0)

fxruby.orgの例では、実際に FXRegistry を使用してアプリ データを保存しています。

于 2015-06-24T17:22:20.710 に答える