小编Ash*_*wal的帖子

XCode 4 - libsqlite3.dylib:没有这样的文件或目录

我正在尝试编译在Xcode 4中使用SQlite的iOS应用程序(对于Snow Leopard),我收到以下错误 -

error: /Apps/Cocktails/libsqlite3.dylib: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我将文件libsqlite3.dylib复制到Xcode项目中,但错误不会消失.我该如何解决错误?

编辑 - 这是完整的错误日志

CpResource libsqlite3.0.dylib /Users/ashishagarwal/Library/Developer/Xcode/DerivedData/Cocktails-gzqdmwrvzqciekgjzxnriugcxwwm/Build/Products/Debug-iphonesimulator/Cocktails.app/libsqlite3.0.dylib
cd /Apps/Cocktails
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Apps/Cocktails/libsqlite3.0.dylib /Users/ashishagarwal/Library/Developer/Xcode/DerivedData/Cocktails-gzqdmwrvzqciekgjzxnriugcxwwm/Build/Products/Debug-iphonesimulator/Cocktails.app

error: /Apps/Cocktails/libsqlite3.dylib: No such file or directory
Run Code Online (Sandbox Code Playgroud)

xcode ios

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

在类型的对象上找不到tableView

我有一个名为FirstViewController的类,它是UIViewController的子类,我在类中有一个UITableView.当按下一行时,我需要从这个类转换到一个新的UIViewController子类(使用segues).

我使用代码使FirstViewController成为UITableViewDelegate和UITableViewDataSource -

@interface FirstViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
Run Code Online (Sandbox Code Playgroud)

我在这行代码上遇到错误 -

NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Run Code Online (Sandbox Code Playgroud)

我如何解决这个问题,因为在UITableViewController中找不到tableView而在UIViewController类中找不到?

编辑 -

这是与我的表视图相关的代码 -

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return [sarray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *cellId = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];

    if(cell == nil){
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }

    NSString *text = [sarray objectAtIndex:[indexPath row]];
    cell.textLabel.text = text;
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

uitableview ios

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

C++错误 - 体系结构x86_64的未定义符号:

我正在学习C++并且有一个简单的Date类,我试图为Date设置一个值.

以下是源代码文件 -

Date.h

class Date{ 
private:
    int month;
    int day;
    int year;

public:
    Date();
    void setDate(int m, int d, int y);

};
Run Code Online (Sandbox Code Playgroud)

和Date.cpp

#include "Date.h"

Date::Date()
{
    month = 1;
    day = 1;
    year = 80;

};

void Date :: setDate(int m1, int d1, int y1){
    month = m1;
    day = d1;
    year = y1;
};
Run Code Online (Sandbox Code Playgroud)

但是,当我编译代码时,我收到错误消息 -

    Undefined symbols for architecture x86_64:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned …
Run Code Online (Sandbox Code Playgroud)

c++

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

使用Objective C中的枚举

我在.h文件中声明了一个枚举.

在Event.h文件中

typedef enum EventType {
    MovementStart = 100019,
    MovementStop = 100020,
    HeartBeat = 100021
} EventType;
Run Code Online (Sandbox Code Playgroud)

我已将Event.h导入到我的ViewController中,并尝试将其用作:

EventType eventType;
NSArray *eventTypes = [NSArray arrayWithObjects:eventType.MovementStart, nil];
Run Code Online (Sandbox Code Playgroud)

这给了我一个错误:成员引用基类型'EventType'(又名'enum EventType')不是结构或联合.

我该如何解决 ?

objective-c

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

在Swift中实现Objective C委托

我有一个Objective C类,其方法如下所示:

@class Client;

@protocol ClientDelegate <NSObject>

@optional
-(void) receivedMessageFromClient : (id) message;

@end

@interface Client : NSObject 

+(id) setup; 
 @property(nonatomic, strong) id <ClientDelegate> clientDelegate;

// more method declarations below
Run Code Online (Sandbox Code Playgroud)

我正在我的Swift类中实现ClientDelegate,如下所示:

class HomeViewController: UIViewController, ClientDelegate {
    var client : AnyObject?
    var delegate: ClientDelegate?

    override func viewDidLoad() {
        super.viewDidLoad()

        client = Client.setup() as! Client
         client.clientDelegate = self
    }

func receivedMessageFromClient(message: AnyObject) {
        print("Message recieved: \(message)")
    }
}
Run Code Online (Sandbox Code Playgroud)

这给了我一个编译错误:

无法分配属性:'self'是不可变的

当我删除线条

client = Client.setup() as! Client
client.clientDelegate = self
Run Code Online (Sandbox Code Playgroud)

代码编译并调用Client类中receivedMessageFromClient的方法,该方法又转发消息,但不调用该方法 …

objective-c swift swift-protocols

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

如何减少逻辑元素的数量

我试图减少我的vhdl代码中的逻辑元素的数量.我正在使用quartus II来编程Altera DE2 FPGA.有人可以就我如何做到这一点给出一些建议吗?

谢谢

fpga vhdl intel-fpga

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

仅限会员网站的部分

我正在尝试在网站上仅限会员.用户必须输入用户名和密码才能登录.我已经为用户设置了注册部分,他们可以在我的网站上创建一个帐户.

同样如下面的代码所示,我可以导航到用户唯一的网站部分.但问题是我需要将值$ myusername传递给页面members_area.php,以便我可以在该页 面上执行一些数据库查询.我怎么做 ?

$sql="SELECT * FROM table_name WHERE email= '$myusername' and password='$mypassword'" ;
$result=mysql_query($sql,$ms);

$user_exist = mysql_num_rows($result);

// if the user is there in the database
if($user_exist>0){ 

    //start a session over here
    $_SESSION["valid_user"] = $myusername;
    Header('Location: members_area.php');
}
Run Code Online (Sandbox Code Playgroud)

php

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

在C中查找字符串的长度(不使用strlen)

下面的代码不会打印任何内容 -

int main() {

        char *input = "This is a string";
        find_length(input);
        return 0;

}
void find_length(char *input){

    printf("%s", input);
    int length = 0;
    while(input[length]!='\0');
    {
        length++;
        printf("%i", length);
    }

}
Run Code Online (Sandbox Code Playgroud)

c

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

Subversion - 命令行更新

将更新到存储库中代码的最新版本的subversion命令行语句是什么?

我已经检出了代码,但是由于某些文件已经更新,我需要更新到最新的代码.

svn

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

使用Objective C从控制台输入字符串

我正在尝试使用Objective C从命令行输入字符串(或整数)。这些数字用空格分隔。

样本输入:1 2 3 4 5

我正在尝试代码

char input[100] = {0};
NSString *inputString;
scanf("%s", input);
inputString = [NSString stringWithCString:input encoding:NSUTF8StringEncoding];
Run Code Online (Sandbox Code Playgroud)

的结果值为inputString1。

如何将整个值放入字符串中?

objective-c

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

将自定义注释添加到MKMapview

我正在尝试添加注释 MKMapView

我创建了一个CustomMapPin符合MKAnnotation协议的类

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface CustomMapPin : NSObject <MKAnnotation> {

    CLLocationCoordinate2D coordinate;
    NSString *title;
    NSString *subtitle;
}

@property(nonatomic, assign) CLLocationCoordinate2D coordinate;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, copy) NSString *subtitle;
@property(nonatomic, strong) NSString *type; // this is to differentiate between the different annotations on the map

@end
Run Code Online (Sandbox Code Playgroud)

我创建了一个类CustomMapAnnotationView,它是一个子类MKAnnotationView

CustomMapAnnotationView.h

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface CustomMapAnnotationView : MKAnnotationView
@property (nonatomic, strong) UIImageView *annotationImage;
@end
Run Code Online (Sandbox Code Playgroud)

CustomMapAnnotationView.m

#import "CustomMapAnnotationView.h"

@implementation CustomMapAnnotationView

-(id) initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString …
Run Code Online (Sandbox Code Playgroud)

mapkit mkmapview ios mapkitannotation

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