小编jro*_*yce的帖子

如何使用字符串值获取NSArray中对象的索引?

我想获取NSMutableArray类别中对象的索引.

category对象有一个属性"category_title",我希望能够通过传递category_title的值来获取索引.

我查看了文档,找不到一个简单的方法来解决这个问题.

iphone objective-c ios

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

"Apple Mach-O链接器命令失败,退出代码为1"

我正在尝试实现SVProgressHUD活动指示器.我将这些类复制到我的项目中,并将以下代码添加到我的appDelegate中,但无法弄清楚它崩溃的原因.

我得到他们跟随错误,我不知道在哪里修复它:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SVProgressHUD", referenced from:
objc-class-ref in QuotesAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
Run Code Online (Sandbox Code Playgroud)

这是代码:

#import "SVProgressHUD.h"

@implementation QuotesAppDelegate


- (void)startLoading
{
    //call this in your app delegate instead of setting window.rootViewController to your main view controller
    //you can show a UIActivityIndiocatorView here or something if you like
    [SVProgressHUD show];
    [self performSelectorInBackground:@selector(loadInBackground) withObject:nil];
}

- (void)loadInBackground
{
    //do your loading …
Run Code Online (Sandbox Code Playgroud)

iphone multithreading ios

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

为什么sqlite数据库浏览器会冻结而不是出错?

当使用SQLite数据库浏览器时,如果我没有使用正确的语法,整个程序会冻结而不是提供错误消息.有没有其他人遇到这个,如果是这样的话有什么方法吗?绕过它的唯一方法是强制退出整个应用程序并重新开始.

否则有一个更好的免费sqlite查询浏览器,我可以用于简单的查询?

谢谢.

sqlite

6
推荐指数
1
解决办法
2817
查看次数

作为卖家,我如何通过 SP-API 更新库存和运输跟踪信息?

我需要通过亚马逊的卖家 SP-API 检索订单,定期更新亚马逊上列出的所有 SKU 的库存,以及在订单发货时更新亚马逊的发货跟踪号码和状态。

到目前为止,我正在使用orders-api 来检索订单上的所有所需数据。

我还没有找到一种简单的方法来更新 SKU 的库存或在订单发货时更新发货跟踪号码。

这是针对卖家的,而不是针对供应商的。产品全部存放在卖家仓库,而不是亚马逊。

我应该使用什么 API 端点来允许更新库存以及在订单发货时更新发货信息?

我已经浏览了此处列出的每个 API 端点。

过去 10 天,我一直在向亚马逊提供支持案例,目前在过去的一个小时里我一直在等待亚马逊支持,电话那头的人说他们也不知道,必须找出答案。

有谁知道什么 API 端点/操作可以做到这一点?

amazon-selling-partner-api

6
推荐指数
1
解决办法
4615
查看次数

使用FMDB保存到数据库会在解释NSInteger时崩溃

当调用以下函数时,我得到EXC_BAD_ACCESS崩溃.看起来FMDB在解释subject_id NSInteger时遇到问题,因为它在WHERE子句中遇到此subject_id列时会通过两个NStrings和炸弹.

- (void) saveAllData {

if(isDirty) {

    DrillDownAppAppDelegate *appDelegate = (DrillDownAppAppDelegate *)[[UIApplication sharedApplication] delegate];
    FMDatabase *database = [FMDatabase databaseWithPath:appDelegate.getDBPath];    

    if ([database open]) {

        [database executeUpdate:@"update Subject Set subject = ?, category = ? where subject_id = ?", 
        self.title, self.category_title, self.subject_id];

        [database close];
    }

    isDirty = NO;
}

//Reclaim all memory here.
[title release];
title = nil;
[category_title release];
category_title = nil;

}
Run Code Online (Sandbox Code Playgroud)

问题与我在FMDB插入问题的另一篇文章中遇到的问题是一样的,这归结为我的subject_id成员有问题.我相信我在标题中使用了错误的声明.这里是:

//
//  Subject.h
//  DrillDownApp

    #import <UIKit/UIKit.h>

    @interface Subject : NSObject {
        NSInteger subject_id;
        NSString *category_title; …
Run Code Online (Sandbox Code Playgroud)

sqlite xcode objective-c fmdb

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

如何从textView制作多页PDF?

我从我的iPhone应用程序生成了一个PDF文件,虽然大多数文档只有一页,但我希望能够检测文本是否超出"边距",如果是,请将其添加到下一页.我是新手,所以不确定如何做到这一点.

下面是代码.有什么建议?

- (void) drawBorder
{
    CGContextRef    currentContext = UIGraphicsGetCurrentContext();
    UIColor *borderColor = [UIColor grayColor];

    CGRect rectFrame = CGRectMake(kBorderInset, kBorderInset, pageSize.width-kBorderInset*2, pageSize.height-kBorderInset*2);

    CGContextSetStrokeColorWithColor(currentContext, borderColor.CGColor);
    CGContextSetLineWidth(currentContext, kBorderWidth);
    CGContextStrokeRect(currentContext, rectFrame);
}

- (void)drawPageNumber:(NSInteger)pageNumber
{
    NSString* pageNumberString = [NSString stringWithFormat:@"Page %d", pageNumber];
    UIFont* theFont = [UIFont systemFontOfSize:12];

    CGSize pageNumberStringSize = [pageNumberString sizeWithFont:theFont
                                               constrainedToSize:pageSize
                                                   lineBreakMode:UILineBreakModeWordWrap];

    CGRect stringRenderingRect = CGRectMake(kBorderInset,
                                            pageSize.height - 40.0,
                                            pageSize.width - 2*kBorderInset,
                                            pageNumberStringSize.height);

    [pageNumberString drawInRect:stringRenderingRect withFont:theFont lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
}

- (void) drawHeader:(NSString *)header
{
    CGContextRef    currentContext = UIGraphicsGetCurrentContext();
    CGContextSetRGBFillColor(currentContext, 0.0, 0.0, …
Run Code Online (Sandbox Code Playgroud)

pdf ios

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

从tableView中删除行

我对从tableview中删除一行的简单操作感到有点迷茫.我有一个带有一个名为SUBJECT的表的sqlite数据库,我想删除该表的记录,从数组中删除该成员并删除tableview中的条目.我不知道什么序列是最好的,我一直在收到错误.

这是代码:

- (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

    if(editingStyle == UITableViewCellEditingStyleDelete) {

        QuotesAppDelegate *appDelegate = (QuotesAppDelegate *)[[UIApplication sharedApplication] delegate];

        //Get the object to delete from the array.
        Subject *sub = [self.subjects objectAtIndex:indexPath.row];

        // check if there are any quoteMaps for this subject and if so do not do it

        NSArray *qm = [appDelegate getQuoteMapsFromSubId:sub.subject_id];

        if (qm.count==0){

            //Delete the object from the table.
            [self.subjects removeObjectAtIndex:indexPath.row];
            [tv deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
            [sub deleteSubject];


        } else {
            //DON'T DO IT BUT GIVE A …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

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

在ORDER BY子句中无效,因为它不包含在聚合函数或GROUP BY子句中

我搜索了这个错误并修改了我的查询,并在聚合函数中按列使用了我的订单.可能是由于对sql的了解较少,我无法捕捉到此错误的确切含义.

我的表中有以下列:

  • [ID]
  • [POST_ID]
  • [用户身份]
  • [photo_id]
  • [photo_group_id]
  • [album_id]

我的查询:

SELECT TOP 3 MAX(share.id) as share_id, share.user_id 
FROM share  
WHERE share.post_id = 5468   
GROUP BY share.user_id 
ORDER BY share.id desc
Run Code Online (Sandbox Code Playgroud)

我正在使用聚合函数中的列按顺序显示它

"share.id"列在ORDER BY子句中无效,因为它不包含在聚合函数或GROUP BY子句中.

任何帮助将不胜感激.:)

sql-server

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

SVProgressHUD未显示活动指示器

我正在尝试实现SVProgressHUD进度活动指标.我从[demo]中复制了这个类.1

我的应用加载但活动指示器未显示.这是我第一次尝试使用其中之一,所以任何帮助将不胜感激.

这是代码:

#import "SVProgressHUD.h"

@implementation QuotesAppDelegate

- (void)startLoading 
{
    //call this in your app delegate instead of setting window.rootViewController to your main view controller
    //you can show a UIActivityIndiocatorView here or something if you like
    [SVProgressHUD show];
    [self performSelectorInBackground:@selector(loadInBackground) withObject:nil];
}

- (void)loadInBackground
{ 
    //do your loading here
    //this is in the background, so don't try to access any UI elements
    [self populateFromDatabase];

    [SVProgressHUD dismiss];

    [self performSelectorOnMainThread:@selector(finishedLoading) withObject:nil waitUntilDone:NO];
}

- (void)finishedLoading
{
    //back on the main thread …
Run Code Online (Sandbox Code Playgroud)

iphone ios svprogresshud

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

如何从字符串中删除换行符?

我需要从字符串中删除任何新行字符.我尝试了下面的stringByReplacingOccurencesOfString方法.在Objective C中执行此操作的正确方法是什么?

[textLine stringByReplacingOccurrencesOfString:@"\n" withString:@""];
Run Code Online (Sandbox Code Playgroud)

string objective-c ios

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