注意:我已经编辑了这个问题的摘要,因为我认为重点必须从 Android API 转移到 Facebook 本身。
自从我的设备更新到 Facebook v42,或者自从 Facebook 将它的 Graph API 更新到 v2.4 (7th August),我的应用程序就无法登录。我的三星 S6 (API 22) 最初失败,3 天后,当我的 HTC (API 21) 更新 Facebook 应用程序时,它在成功之前也无法登录。
采取的初步步骤:
更新 1:
ParseException 取自评论:“用户以不同的 Facebook 用户身份登录。”
如果我使用 我的 Facebook 凭据登录,该应用不会出错。由于我不是注册测试用户,它应该在 Parse 数据库中创建一个用户并继续到 MainActivity。相反,LoginActivity 仍然存在,并且我的数据没有添加到数据库中。
更新 2:
我运行 5.0 的 HTC 今天刚刚更新了 Facebook 应用程序,现在出现了同样的错误 Toast(“Facebook 登录失败”)。我禁用并卸载了该应用,但 Toast 仍然出现。
更新 3:
我已更新 Parse SDK,并更改了我的依赖项以反射(reflect)最新的 Facebook SDK (4.5.0)。同样的错误仍然发生。
更新 4:
该应用可以在任何没有原生 Facebook 应用的模拟器上成功登录。
ParseLoginFragment - 实现 toast 的地方
private LogInCallback facebookLoginCallbackV4 = new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (isActivityDestroyed()) {
return;
}
if (user == null) {
loadingFinish();
if (e != null) {
showToast(R.string.com_parse_ui_facebook_login_failed_toast);
debugLog(getString(R.string.com_parse_ui_login_warning_facebook_login_failed) +
e.toString());
}
} else if (user.isNew()) {
// rest of code
禁用原生 Facebook 应用的 LogCat:
08-14 22:50:28.151 30719-30719/com.guile.occ I/InjectionManager﹕ Inside getClassLibPath + mLibMap{0=, 1=}
08-14 22:50:28.151 30719-30719/com.guile.occ I/InjectionManager﹕ Inside getClassLibPath caller
08-14 22:50:28.191 30719-30739/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
08-14 22:50:28.191 30719-30739/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isShipBuild true
08-14 22:50:28.191 30719-30739/com.guile.occ I/System.out﹕ (HTTPLog)-Thread-32296-266222247: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
08-14 22:50:28.191 30719-30739/com.guile.occ I/System.out﹕ (HTTPLog)-Thread-32296-266222247: SMARTBONDING_FEATURE_ENABLED is true
08-14 22:50:28.191 30719-30739/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
08-14 22:50:28.211 30719-30719/com.guile.occ D/InjectionManager﹕ InjectionManager
08-14 22:50:28.211 30719-30719/com.guile.occ D/InjectionManager﹕ fillFeatureStoreMap com.guile.occ
08-14 22:50:28.211 30719-30719/com.guile.occ I/InjectionManager﹕ Constructor com.guile.occ, Feature store :{}
08-14 22:50:28.211 30719-30719/com.guile.occ I/InjectionManager﹕ featureStore :{}
08-14 22:50:28.211 30719-30719/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:50:28.211 30719-30719/com.guile.occ I/Timeline﹕ Timeline: Activity_launch_request id:com.guile.occ time:88929116
08-14 22:50:28.221 30719-30719/com.guile.occ D/Activity﹕ performCreate Call Injection manager
08-14 22:50:28.221 30719-30719/com.guile.occ I/InjectionManager﹕ dispatchOnViewCreated > Target : com.guile.occ.LoginActivity isFragment :false
08-14 22:50:28.231 30719-30719/com.guile.occ D/Activity﹕ performCreate Call Injection manager
08-14 22:50:28.241 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor mIsFloating : false
08-14 22:50:28.241 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor flags : -2139029248
08-14 22:50:28.271 30719-30719/com.guile.occ I/InjectionManager﹕ dispatchOnViewCreated > Target : com.parse.ui.ParseLoginActivity isFragment :false
08-14 22:50:28.271 30719-30719/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:50:28.281 30719-30754/com.guile.occ D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
08-14 22:50:28.281 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:50:28.281 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:50:28.291 30719-30719/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:50:28.311 30719-30754/com.guile.occ D/libEGL﹕ loaded /vendor/lib64/egl/libGLES_mali.so
08-14 22:50:28.331 30719-30754/com.guile.occ I/OpenGLRenderer﹕ Initialized EGL, version 1.4
08-14 22:50:28.331 30719-30754/com.guile.occ I/OpenGLRenderer﹕ HWUI protection enabled for context , &this =0x7f7d8d6b20 ,&mEglDisplay = 1 , &mEglConfig = 2107568816
08-14 22:50:28.331 30719-30754/com.guile.occ D/OpenGLRenderer﹕ Get maximum texture size. GL_MAX_TEXTURE_SIZE is 8192
08-14 22:50:28.331 30719-30754/com.guile.occ D/OpenGLRenderer﹕ Enabling debug mode 0
08-14 22:50:28.331 30719-30754/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [1440x2560]-format:1
08-14 22:50:28.451 30719-30719/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@38cba1f0 time:88929356
08-14 22:50:28.451 30719-30719/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@2e8ef184 time:88929358
08-14 22:50:29.061 30719-30739/com.guile.occ I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
08-14 22:50:37.661 30719-30719/com.guile.occ D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
08-14 22:50:37.731 30719-30855/com.guile.occ E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
08-14 22:50:37.731 30719-30719/com.guile.occ I/Timeline﹕ Timeline: Activity_launch_request id:com.guile.occ time:88938639
08-14 22:50:37.771 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor mIsFloating : false
08-14 22:50:37.771 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor flags : 8454400
08-14 22:50:37.771 30719-30719/com.guile.occ D/Activity﹕ performCreate Call Injection manager
08-14 22:50:37.771 30719-30719/com.guile.occ I/InjectionManager﹕ dispatchOnViewCreated > Target : com.facebook.FacebookActivity isFragment :false
08-14 22:50:37.771 30719-30719/com.guile.occ E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.PlatformProvider
08-14 22:50:37.771 30719-30719/com.guile.occ E/ActivityThread﹕ Failed to find provider info for com.facebook.wakizashi.provider.PlatformProvider
08-14 22:50:37.801 30719-30719/com.guile.occ I/WebViewFactory﹕ Loading com.google.android.webview version 44.0.2403.90 (code 240309050)
08-14 22:50:37.801 30719-30719/com.guile.occ I/InjectionManager﹕ Inside getClassLibPath caller
08-14 22:50:37.801 30719-30719/com.guile.occ I/LibraryLoader﹕ Time to load native libraries: 0 ms (timestamps 8709-8709)
08-14 22:50:37.801 30719-30719/com.guile.occ I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
08-14 22:50:37.811 30719-30719/com.guile.occ V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {23858b22}
08-14 22:50:37.811 30719-30719/com.guile.occ I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
08-14 22:50:37.811 30719-30719/com.guile.occ I/chromium﹕ [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
08-14 22:50:37.821 30719-30719/com.guile.occ I/BrowserStartupController﹕ Initializing chromium process, singleProcess=true
08-14 22:50:37.821 30719-30719/com.guile.occ W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
08-14 22:50:37.821 30719-30719/com.guile.occ E/SysUtils﹕ ApplicationContext is null in ApplicationStatus
08-14 22:50:37.831 30719-30719/com.guile.occ W/chromium﹕ [WARNING:resource_bundle.cc(285)] locale_file_path.empty()
08-14 22:50:37.831 30719-30719/com.guile.occ E/libEGL﹕ validate_display:255 error 3008 (EGL_BAD_DISPLAY)
08-14 22:50:37.831 30719-30719/com.guile.occ E/libEGL﹕ validate_display:255 error 3008 (EGL_BAD_DISPLAY)
08-14 22:50:37.841 30719-30871/com.guile.occ W/AudioManagerAndroid﹕ Requires BLUETOOTH permission
08-14 22:50:37.861 30719-30719/com.guile.occ W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
08-14 22:50:37.871 30719-30719/com.guile.occ W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring
08-14 22:50:37.881 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor mIsFloating : false
08-14 22:50:37.881 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor flags : 8454400
08-14 22:50:37.881 30719-30719/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:50:37.891 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:50:37.891 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:50:37.891 30719-30719/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:50:37.911 30719-30719/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:50:37.911 30719-30754/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [1440x2560]-format:1
08-14 22:50:37.921 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:50:37.921 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:50:37.921 30719-30719/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:50:37.921 30719-30754/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [1440x2560]-format:1
08-14 22:50:37.931 30719-30869/com.guile.occ W/chromium﹕ [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
08-14 22:50:38.001 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor mIsFloating : true
08-14 22:50:38.001 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor flags : 8388610
08-14 22:50:38.041 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:50:38.041 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:50:38.041 30719-30719/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:50:38.041 30719-30754/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [667x461]-format:1
08-14 22:50:38.061 30719-30719/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@188ff958 time:88938965
08-14 22:50:38.061 30719-30719/com.guile.occ V/ActivityThread﹕ updateVisibility : ActivityRecord{30111b2c token=android.os.BinderProxy@38cba1f0 {com.guile.occ/com.parse.ui.ParseLoginActivity}} show : true
08-14 22:50:40.631 30719-30719/com.guile.occ W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 30719
08-14 22:50:41.221 30719-30719/com.guile.occ E/ViewRootImpl﹕ sendUserActionEvent() mView == null
08-14 22:50:44.081 30719-30719/com.guile.occ D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
08-14 22:50:44.211 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:50:44.211 30719-30719/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:50:44.231 30719-30719/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:50:44.241 30719-30754/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [667x461]-format:1
08-14 22:50:45.901 30719-30719/com.guile.occ W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 30719
08-14 22:50:45.981 30719-30719/com.guile.occ E/ViewRootImpl﹕ sendUserActionEvent() mView == null
08-14 22:50:45.981 30719-30719/com.guile.occ E/ViewRootImpl﹕ sendUserActionEvent() mView == null
08-14 22:50:46.001 30719-30719/com.guile.occ E/ViewRootImpl﹕ sendUserActionEvent() mView == null
08-14 22:50:46.011 30719-30756/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
08-14 22:50:46.011 30719-30719/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@38cba1f0 time:88946918
08-14 22:50:52.751 30719-30853/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
启用原生 Facebook 应用的 LogCat:
08-14 22:59:45.761 13249-13249/com.guile.occ E/Zygote﹕ MountEmulatedStorage()
08-14 22:59:45.761 13249-13249/com.guile.occ E/Zygote﹕ v2
08-14 22:59:45.761 13249-13249/com.guile.occ I/libpersona﹕ KNOX_SDCARD checking this for 10033
08-14 22:59:45.761 13249-13249/com.guile.occ I/libpersona﹕ KNOX_SDCARD not a persona
08-14 22:59:45.761 13249-13249/com.guile.occ I/SELinux﹕ Function: selinux_compare_spd_ram , priority [2] , priority version is VE=SEPF_SM-G925F_5.1.1_0030
08-14 22:59:45.761 13249-13249/com.guile.occ E/SELinux﹕ [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
08-14 22:59:45.761 13249-13249/com.guile.occ I/art﹕ Late-enabling -Xcheck:jni
08-14 22:59:45.771 13249-13249/com.guile.occ D/TimaKeyStoreProvider﹕ TimaSignature is unavailable
08-14 22:59:45.781 13249-13249/com.guile.occ D/ActivityThread﹕ Added TimaKeyStore provider
08-14 22:59:45.801 13249-13249/com.guile.occ I/InjectionManager﹕ Inside getClassLibPath + mLibMap{0=, 1=}
08-14 22:59:45.811 13249-13249/com.guile.occ I/InjectionManager﹕ Inside getClassLibPath caller
08-14 22:59:45.871 13249-13285/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
08-14 22:59:45.871 13249-13285/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isShipBuild true
08-14 22:59:45.871 13249-13285/com.guile.occ I/System.out﹕ (HTTPLog)-Thread-33185-403364762: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
08-14 22:59:45.871 13249-13285/com.guile.occ I/System.out﹕ (HTTPLog)-Thread-33185-403364762: SMARTBONDING_FEATURE_ENABLED is true
08-14 22:59:45.871 13249-13285/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
08-14 22:59:45.881 13249-13285/com.guile.occ I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
08-14 22:59:45.891 13249-13249/com.guile.occ D/InjectionManager﹕ InjectionManager
08-14 22:59:45.891 13249-13249/com.guile.occ D/InjectionManager﹕ fillFeatureStoreMap com.guile.occ
08-14 22:59:45.901 13249-13249/com.guile.occ I/InjectionManager﹕ Constructor com.guile.occ, Feature store :{}
08-14 22:59:45.901 13249-13249/com.guile.occ I/InjectionManager﹕ featureStore :{}
08-14 22:59:45.911 13249-13249/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:59:45.911 13249-13249/com.guile.occ I/Timeline﹕ Timeline: Activity_launch_request id:com.guile.occ time:89486819
08-14 22:59:45.921 13249-13249/com.guile.occ D/Activity﹕ performCreate Call Injection manager
08-14 22:59:45.921 13249-13249/com.guile.occ I/InjectionManager﹕ dispatchOnViewCreated > Target : com.guile.occ.LoginActivity isFragment :false
08-14 22:59:45.941 13249-13249/com.guile.occ D/Activity﹕ performCreate Call Injection manager
08-14 22:59:45.961 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor mIsFloating : false
08-14 22:59:45.961 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor flags : -2139029248
08-14 22:59:45.991 13249-13249/com.guile.occ I/InjectionManager﹕ dispatchOnViewCreated > Target : com.parse.ui.ParseLoginActivity isFragment :false
08-14 22:59:46.001 13249-13249/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:59:46.001 13249-13319/com.guile.occ D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
08-14 22:59:46.011 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:59:46.011 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:59:46.031 13249-13249/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:59:46.061 13249-13319/com.guile.occ D/libEGL﹕ loaded /vendor/lib64/egl/libGLES_mali.so
08-14 22:59:46.071 13249-13319/com.guile.occ I/OpenGLRenderer﹕ Initialized EGL, version 1.4
08-14 22:59:46.081 13249-13319/com.guile.occ I/OpenGLRenderer﹕ HWUI protection enabled for context , &this =0x7f7d8d6d60 ,&mEglDisplay = 1 , &mEglConfig = 2107732656
08-14 22:59:46.081 13249-13319/com.guile.occ D/OpenGLRenderer﹕ Get maximum texture size. GL_MAX_TEXTURE_SIZE is 8192
08-14 22:59:46.081 13249-13319/com.guile.occ D/OpenGLRenderer﹕ Enabling debug mode 0
08-14 22:59:46.081 13249-13319/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [1440x2560]-format:1
08-14 22:59:46.191 13249-13249/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@ce0ed1c time:89487096
08-14 22:59:46.191 13249-13249/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@38cba1f0 time:89487096
08-14 22:59:58.291 13249-13249/com.guile.occ D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
08-14 22:59:58.401 13249-13249/com.guile.occ I/Timeline﹕ Timeline: Activity_launch_request id:com.guile.occ time:89499300
08-14 22:59:58.461 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor mIsFloating : false
08-14 22:59:58.461 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* installDecor flags : 8454400
08-14 22:59:58.461 13249-13249/com.guile.occ D/Activity﹕ performCreate Call Injection manager
08-14 22:59:58.471 13249-13249/com.guile.occ I/InjectionManager﹕ dispatchOnViewCreated > Target : com.facebook.FacebookActivity isFragment :false
08-14 22:59:58.481 13249-13249/com.guile.occ D/SecWifiDisplayUtil﹕ Metadata value : SecSettings2
08-14 22:59:58.491 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
08-14 22:59:58.491 13249-13249/com.guile.occ D/PhoneWindow﹕ *FMB* isFloatingMenuEnabled return false
08-14 22:59:58.501 13249-13249/com.guile.occ D/SRIB_DCS﹕ log_dcs ThreadedRenderer::initialize entered!
08-14 22:59:58.501 13249-13319/com.guile.occ D/mali_winsys﹕ new_window_surface returns 0x3000, [1440x2560]-format:1
08-14 22:59:58.541 13249-13249/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@5562ab1 time:89499446
08-14 22:59:58.541 13249-13249/com.guile.occ V/ActivityThread﹕ updateVisibility : ActivityRecord{2d7dbc2b token=android.os.BinderProxy@ce0ed1c {com.guile.occ/com.parse.ui.ParseLoginActivity}} show : true
08-14 22:59:58.691 13249-13457/com.guile.occ I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
08-14 22:59:58.911 13249-13249/com.guile.occ I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@ce0ed1c time:89499810
最佳答案
每个 Android 迭代都有自己的 WebView 实现,无论好坏。 5.0+ Android 使用基于应用程序的实现,它会定期更新等等,但也不同于以前的实现。
长话短说,我相信这是我的问题。 WebView 可以为您的登录维护 session 或将凭据保存在 cookie 存储中以供重复使用/确认。我不能在这里提供直接的解决方案,因为我对新 WebView 的内部不太熟悉,但请尝试在每次新登录之前强制清除 session 和/或 cookie 存储,看看会发生什么。
关于android - 使用 Facebook 登录解析 - 可能从 APK v42 或 Graph API v2.4 开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31973652/
我正在学习如何使用Nokogiri,根据这段代码我遇到了一些问题:require'rubygems'require'mechanize'post_agent=WWW::Mechanize.newpost_page=post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708')puts"\nabsolutepathwithtbodygivesnil"putspost_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
假设我做了一个模块如下:m=Module.newdoclassCendend三个问题:除了对m的引用之外,还有什么方法可以访问C和m中的其他内容?我可以在创建匿名模块后为其命名吗(就像我输入“module...”一样)?如何在使用完匿名模块后将其删除,使其定义的常量不再存在? 最佳答案 三个答案:是的,使用ObjectSpace.此代码使c引用你的类(class)C不引用m:c=nilObjectSpace.each_object{|obj|c=objif(Class===objandobj.name=~/::C$/)}当然这取决于
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po