小编Chr*_*lay的帖子

如何在Git中显示自标签以来的名称和提交标题?

我正在尝试在Git中使用标签进行发布管理 - 我为每个版本创建一个标签.我希望能够通过列出自标记以来或每个标记之间的每个提交的注释标题来创建发行说明.我似乎无法找到任何方法来做到这一点.

git git-log

58
推荐指数
3
解决办法
2万
查看次数

git mergetool报告"没有文件需要合并"

由于某些原因,最近每次拉动并发生合并冲突时,运行git mergetool报告"没有文件需要合并":

$ git pull
First, rewinding head to replay your work on top of it...
Applying: replaced home button with Cancel
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
    Classes/Controllers/HomeController.m
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0002 moved rollback into cancel …
Run Code Online (Sandbox Code Playgroud)

git git-merge

38
推荐指数
4
解决办法
2万
查看次数

objective-c本地化字符串文件中的多行字符串

我有一个电子邮件的模板,我已经放入一个本地化的字符串文件,我正在加载NSLocalizedString宏的字符串.

我宁愿不使用唯一键使每一行成为自己的字符串.在Objective-C中,我可以创建一个人类可读的多行字符串,如下所示:

NSString *email = @"Hello %@,\n"
    "\n"
    "Check out %@.\n"
    "\n"
    "Sincerely,\n"
    "\n"
    "%@";
Run Code Online (Sandbox Code Playgroud)

我试着把它放在.strings文件中:

"email" = "Hello %@,\n"
    "\n"
    "Check out %@.\n"
    "\n"
    "Sincerely,\n"
    "\n"
    "%@";
Run Code Online (Sandbox Code Playgroud)

但是我在构建时遇到以下错误:

CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary.
email-template.strings: Unexpected character " at line 1
Command /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

我可以像这样将它连接在一起:

"email" = "Hello %@,\n\nCheck out %@.\n\nSincerely,\n\n%@";
Run Code Online (Sandbox Code Playgroud)

但这将是一个混乱的维护,特别是随着电子邮件变得更长.

有没有办法在本地化的字符串文件中执行此操作?我已经尝试在每一行的末尾添加反斜杠,但无济于事.

iphone localization objective-c nslocalizedstring

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

iOS应用内购买商品未在产品中退回,但仅在沙盒中的invalidProductIdentifiers中返回.怎么调试?

我正在为我的应用添加应用内购买.我已按照Apple概述的所有步骤(http://developer.apple.com/library/ios/#technotes/tn2259/_index.html特别参见问答#6)以及应用内编程指南.

问题是,当我在测试iPod Touch上发送产品请求时,响应会在invalidProductIdentifiers中显示,而不是有效的产品.

我的应用程序确实有一个特定的非外卡应用程序ID.

我用于签署应用程序的个人资料中明确显示了应用程序ID,并且不使用外卡.

应用内购买项目是标准的非消耗性非订阅项目(启用增强功能).我在商店中将其添加为我的应用程序的应用内商品.它已被准备出售.(处于状态"等待屏幕截图上传").

我从iTunes Connect中复制并粘贴了应用内商品ID并将其粘贴到我的应用中,以确保我没有拼错.

我在StackOverflow上搜索并使用Bing和Google提供有关如何诊断此问题的线索,基本上所有答案都是检查应用ID,项目ID,签名配置文件等.

没有返回错误,产品请求成功完成,因此没有要查询的NSError对象.

如何诊断问题并进行调试?

谢谢

storekit in-app-purchase ios4

7
推荐指数
1
解决办法
2697
查看次数

AudioServicesPlaySystemSound无法在iPad设备上运行

我正处于开发我的第一个iPad应用程序的早期阶段,为了简单起见,我到目前为止一直在使用AudioServicesPlaySystemSound和相关的函数来播放声音.我的代码基于Apple的Metronome示例中的SoundEffect类.

特定的症状是我可以听到模拟器中的声音但不能听到设备上的声音,尽管我已经确认我可以听到设备上其他应用程序的声音.AudioServicesCreateSystemSoundID返回有效的声音标识符,因此它不像具有不同情况的声音文件的名称那样简单,即"sound.mp3"与"Sound.mp3".

我知道我可能需要切换到不同的库,例如OpenAL,原因无关,但我想知道这里发生了什么.有没有人有什么建议?我可以调用一个函数来获取OSStatus值吗?

* BUMP - 过去几周我一直在研究其他项目,但我现在又重新开始了,我真的很感激答案.谢谢.

audio ipad audiotoolbox

6
推荐指数
2
解决办法
5720
查看次数

使用iOS Twitter API递归使用objective-c块

因此,我尝试使用iOS 5中内置的Twitter API来检索给定用户的所有关注者列表.在我可以找到的所有示例文档中,请求API传递在请求返回时要执行的内联块,这对于大多数更简单的东西来说都很好,但是当我试图获得~1000个粉丝时,请求返回大小为~100的页面,我仍然坚持如何使用在完成块内返回并处理的"下一个寻呼地址"再次递归调用请求.这是代码:

- (void)getTwitterFollowers {
    //  First, we need to obtain the account instance for the user's Twitter account
    ACAccountStore *store = [[ACAccountStore alloc] init];
    ACAccountType *twitterAccountType = 
    [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

    //  Request access from the user for access to his Twitter accounts
    [store requestAccessToAccountsWithType:twitterAccountType 
                     withCompletionHandler:^(BOOL granted, NSError *error) {
        if (!granted) {
            // The user rejected your request 
            NSLog(@"User rejected access to his account.");
        } 
        else {
            // Grab the available accounts
            NSArray *twitterAccounts = 
            [store accountsWithAccountType:twitterAccountType];

            if ([twitterAccounts …
Run Code Online (Sandbox Code Playgroud)

twitter recursion objective-c ios objective-c-blocks

5
推荐指数
2
解决办法
2043
查看次数

验证自引用关联不会链接回rails中的原始实例

我有一个多对多模型,遵循这个伟大的railscast中的示例

我的模型将作者彼此联系起来.我想验证作者不能自己交朋友.我知道我可以在UI级别处理这个问题,但是我希望能够进行验证以防止UI中的错误允许它.我已经尝试过validates_exclusion_of,但它不起作用.这是我的关系模型:

class Friendship < ActiveRecord::Base
  # prevent duplicates
  validates_uniqueness_of :friend_id, :scope => :author_id
  # prevent someone from following themselves (doesn't work)
  validates_exclusion_of :friend_id, :in => [:author_id]

  attr_accessible :author_id, :friend_id
  belongs_to :author
  belongs_to :friend, :class_name => "Author"
end
Run Code Online (Sandbox Code Playgroud)

validation many-to-many ruby-on-rails self-reference

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

如何将HTML模板加载到WebView中?

想象一下HTML模板,如下所示:

<html>
<head>
    <style type="text/css">
        body {
            color: white;
        }
    </style>
</head>
<body>
The changes include:
<br/><br/>
%1$s
<br/><br/>
Would you like to update now?
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我知道我可以将内容加载到WebView中webView.loadUrl("file:///android_asset/html/upgrade.html").但我也想在运行时替换$ 1,就好像我是使用XML文件加载它一样String.format().

是否可以先将文件内容加载到String中,以便我可以String.format()在其上运行然后使用webView.loadData()

android webview

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