Iphone 将NSInteger传递给方法无效

Iphone 将NSInteger传递给方法无效,iphone,objective-c,ios,nsstring,Iphone,Objective C,Ios,Nsstring,我正在调用一个方法getAllProductsByManufacturedID,该方法接收NSInteger作为参数,请参见下面的代码: // call the method with int value [dbAccess getAllProductsByManufacturedID:5]; // method for extract all row with manufactured id = ? - (NSMutableArray*)getAllProductsByManufacture

我正在调用一个方法getAllProductsByManufacturedID,该方法接收NSInteger作为参数,请参见下面的代码:

// call the method with int value
[dbAccess getAllProductsByManufacturedID:5];

// method for extract all row with manufactured id = ?
- (NSMutableArray*)getAllProductsByManufacturedID:(NSInteger *)manufactID
{
    const char *sql = "SELECT * FROM Product WHERE manufacturerid = ?";

    sqlite3_stmt *statement;

    if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL)== SQLITE_OK) 
    {
       sqlite3_bind_int(statement, 1, manufactID);
    }
}
我认为有两个问题:
1) (NSMutableArray*)getAllProductsByManufacturedID:(NSInteger*)ManufactureId

2) sqlite3_bind_int(语句,1,制造ID)

NSInteger
不是对象。您通常不会使用指向它的指针。您在此处的签名应为:

- (NSArray*)allProductsForManufacturedID:(NSInteger)manufactID
使用
get
表明
manufactuid
是一个引用返回,而不是。您还希望在此处使用
xForY
,而不是
xByY
。您的名字听起来应该返回一个
NSDictionary


如果这对调用者特别好,您可以将其作为可变数组返回,但通常这是一个普通数组。这样,如果您以后更改此代码以缓存结果,调用方将不会感到惊讶。

NSInteger
不是对象。您通常不会使用指向它的指针。您在此处的签名应为:

- (NSArray*)allProductsForManufacturedID:(NSInteger)manufactID
使用
get
表明
manufactuid
是一个引用返回,而不是。您还希望在此处使用
xForY
,而不是
xByY
。您的名字听起来应该返回一个
NSDictionary

如果这对调用者特别好,您可以将其作为可变数组返回,但通常这是一个普通数组。这样,如果以后更改此代码以缓存结果,调用方将不会感到惊讶