小编J.J*_*.J.的帖子

无法使用GooglePlusPlatform从GooglePlusSample代码登录Google

我正在运行Google提供的GooglePlusPlatform示例代码,以了解其SDk.但是,当我运行应用程序并单击登录按钮时,它会生成错误:

Error Domain = com.google.GooglePlusPlatform Code = -1"keychain error"UserInfo = 0x1100bdd0 {NSLocalizedDescription = keychain error}

在我创建的另一个使用GooglePlus登录的应用程序中也会出现同样的错误.我用Google搜索,但找不到任何有用的内容.请帮忙!

keychain ios google-plus

14
推荐指数
2
解决办法
2573
查看次数

未处理的异常org.json.jsonexception

我正在开发一个Android应用程序,应用程序必须将json格式的java对象保存到SQLite数据库中.我为此操作编写了代码,然后他们必须提取Json对象并将其重新转换为Java对象.当我尝试调用方法将json对象反序列化为字符串时,我在Android Studio中发现了这个错误:unhandled exception org.json.jsonexception

当我尝试捕获JSONException e程序运行但不反序列化json对象.

这是该方法的代码:

private void read() throws JSONException {
    SQLiteDatabase db = mMioDbHelper.getWritableDatabase();
    String[] columns = {"StringaAll"};
    Cursor c = db.query("Alle", columns, null, null, null, null,null );
    while(c.moveToNext()) {
        String stringaRis =  c.getString(0);
        JSONObject jObj = new JSONObject(stringaRis);
        String sPassoMed = jObj.getString("passoMed");
        final TextView tView = (TextView) this.findViewById(R.id.mainProvaQuery);
        tView.setText(sPassoMed);
        // }
    }
}
Run Code Online (Sandbox Code Playgroud)

你能帮我吗?

java sqlite android json

11
推荐指数
1
解决办法
3万
查看次数

如何将System.Net.ICredentials传递给API?

首先,使用所述API进行身份验证的凭据:

Webservice.Authenticate.Credential credential = new Webservice.Authenticate.Credential
{
    Username = "myUserName",
    Password = GetMD5("myPassword"), // See below for a MD5 encoding example method
    ApplicationId = new Guid("00000000-0000-0000-0000-000000000000"), //YOUR ID HERE
    IdentityId = new Guid("00000000-0000-0000-0000-000000000000") //Default is empty guid (no need to edit this)
};
Run Code Online (Sandbox Code Playgroud)

如果我尝试直接将凭据用作Icredentials,_service.Credentials = credential;则会发生以下错误:

无法将auth.credential类型隐式转换为system.net.icredentials.我试图施放它,但它无法正常工作.

后来,当调用另一个服务时,我尝试以这种方式使用凭据.但是,我不确定如何传递凭据.

TransactionService.TransactionService _service = new TransactionService.TransactionService();
TransactionService.TransactionSearchParameters _params = new TransactionService.TransactionSearchParameters();
_service.Credentials = new NetworkCredential(credential.Username, credential.Password);
Run Code Online (Sandbox Code Playgroud)

c#

4
推荐指数
1
解决办法
8515
查看次数

jinja 块有默认参数吗

如果块未填充,是否有办法创建默认条目?

我有一个模板,其中有一个按钮,上面写着create

myTemplate.html:

<a href="#" class="btn">create</a>
Run Code Online (Sandbox Code Playgroud)

到目前为止,使用此模板的所有页面都使用了测试创建,但是现在我希望能够从我的页面编辑该文本。

通常我会向模板添加一个块以供页面覆盖:

myTemplate.html:

<a href="#" class="btn">{% block createString %}{% endblock %}</a>
Run Code Online (Sandbox Code Playgroud)

myPage.html:

{% extends "myTemplate.html" %}
{% block createString %}next{% endblock %}
Run Code Online (Sandbox Code Playgroud)

createString但是,为此我希望有一个类似默认值的东西,这样如果我的 myPage 中没有任何块,则将使用默认字符串。

就像是:

myTemplate.html:

<a href="#" class="btn">{% block createString %}{% default %}create
                        {% endblock %}</a>
Run Code Online (Sandbox Code Playgroud)

myPage.html中,按钮将显示“ next” ,而在扩展myTemplate.html 的其他文件中,按钮将显示“create”

html jinja2

4
推荐指数
1
解决办法
943
查看次数

如何让UIButton只出现在最后一个单元格中?

我对Objective C编程很新,并且有一个带有自定义单元格的UITableView设置.我想这样做,以便用户可以触摸将添加另一个单元格的按钮,此按钮将仅显示在最后一个单元格中.目前,它没有出现.这是我正在使用的代码.我在自定义单元格中创建了按钮,并使用"setHidden:YES"将其隐藏在单元格内.我正在尝试"setHidden:NO"使按钮出现在TableView代码中,但它无法正常工作.我想也许它与重新加载单元格有关,但我不确定我是否正朝着正确的方向前进.谢谢,我将不胜感激.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{workoutTableViewCell *cell = (workoutTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

// Configure the cell...
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
[cell.addButton setTitle:(NSString *)indexPath forState:UIControlStateApplication];
[cell.textLabel setText:[NSString stringWithFormat:@"Row %i in Section %i", [indexPath row], [indexPath section]]];

NSInteger sectionsAmount = [tableView numberOfSections];
NSInteger rowsAmount = [tableView numberOfRowsInSection:[indexPath section]];

if ([indexPath section] == sectionsAmount - 1 && [indexPath row] == rowsAmount - 1) {
    NSLog(@"Reached last cell");
    [cell.addButton setHidden:NO];
    if (lc == NO) …
Run Code Online (Sandbox Code Playgroud)

objective-c uibutton uitableview ios

3
推荐指数
1
解决办法
2044
查看次数

如何使用单个故事板为不同的屏幕尺寸(例如:iPhone 3.5",4",4.7"和5.5")设置不同的约束?

我试过

我已经搜索过了,但没有得到任何富有成效的答案.我想在单个故事板本身中为所有不同的屏幕大小设置不同的约束(不是以编程方式).

我该如何解决这个问题?

提前致谢 !!

iphone objective-c ios xcode6

2
推荐指数
1
解决办法
1620
查看次数

NSTimer在此函数中失效时不会停止

我正在尝试使用NTTimer,但它不起作用.

它从这里开始:

timer = NSTimer.scheduledTimerWithTimeInterval(0.003, target: self, selector: "openFrameAnimation", userInfo: nil, repeats: true)
Run Code Online (Sandbox Code Playgroud)

它激发了这个功能:

func openFrameAnimation(){
    Swift.print("Animation Goes... ",NSDate().timeIntervalSince1970)
    self.frame = NSRect(x: self.frame.origin.x,
        y: self.frame.origin.y-12,
        width: self.frame.width,
        height: self.frame.height + 12)
    if(self.frame.height >= self.finalFrame.height){
        Swift.print("STOP")
        self.frame = self.finalFrame
        timer.invalidate()
        // timer = nil //ERROR: nil cannot be assigned to type "NSTimer"
    }
    self.needsDisplay = true
}
Run Code Online (Sandbox Code Playgroud)

即使反复打印"STOP",计时器仍继续调用openFrameAnimation,我无法阻止它.如果验证条件,我该如何停止计时器?

日志:

[...]
*Animation Goes...  1456613095.27813
STOP
[...]
Animation Goes...  1456613095.51233
STOP
Animation Goes...  1456613095.54458
[...]
STOP
Animation Goes...  1456613095.5938
STOP*
Run Code Online (Sandbox Code Playgroud)

nstimer swift

2
推荐指数
1
解决办法
3011
查看次数

如何使用Android fragmentmanager传递变量

我有以下简单的代码在内容框架中从一个片段切换到另一个片段.是否有一种简单的方法可以在以下代码中传递变量?

FragmentManager fm = getActivity().getFragmentManager();

fm.beginTransaction().replace(R.id.content_frame, new TransactionDetailsFragment()).commit();
Run Code Online (Sandbox Code Playgroud)

android android-fragments fragmentmanager

2
推荐指数
1
解决办法
4455
查看次数

检索没有前导零的当前日期

我正在尝试将日历(Kal 日历实现)上选择的日期与当前日期进行比较。问题是当前日期采用 MM/dd/yyyy 格式,而如果月份或日期低于 1​​0,则 Kal 日期将没有前导零。是否有一种简单的方法来检索当前日期,以便它不会有如果天数或月数小于 10,则前导零?(当前日期实际上将用作保存对象的属性,以便以后可以使用 Kal 选择的日期查询它们)

示例当前日期 - 07/07/2014

示例 Kal 日期 - 7/7/2014

cocoa-touch date nsdate ios kal

0
推荐指数
1
解决办法
2119
查看次数

为什么javascript无法获得表单值?

我试图从表单中检索此值,但它没有返回任何内容.该如何修复?谁能指出我正确的方向?

function checkForm()
{
  numrows = document.theform.numrows.value;
  if(numrows == -1)
  {
    alert("You have not chosen any options yet");
    return false;
  }

  emailcheckcount = 0;
  for(i=0; i<=numrows; i++)
  {
      var recid = document.theform.recid'+i+'.value; //why is this failing to get value here?
      alert("Test" + recid);
      return false;
  }
}
Run Code Online (Sandbox Code Playgroud)

html javascript

0
推荐指数
1
解决办法
42
查看次数