在我的应用中阅读iphone消息收件箱 [英] Reading iphone messages inbox in my app

查看:105
本文介绍了在我的应用中阅读iphone消息收件箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在阅读我的应用程序中的iphone消息收件箱时遇到问题,我使用了以下代码:

I have a problem in reading iphone messages inbox in my app,and i used this code :

- (IBAction) read{

    NSString *text = @"";

    sqlite3 *database;
    if(sqlite3_open([@"/var/root/Library/SMS/sms.db" UTF8String], &database) == SQLITE_OK) {
        sqlite3_stmt *statement;

        const char *sql4 = "SELECT * from message ORDER BY rowid DESC";  // TODO: different for iOS 4.* ???
        const char *sql5 = "SELECT * from message ORDER BY rowid DESC";

        NSString *osVersion =[[UIDevice currentDevice] systemVersion];         
        if([osVersion hasPrefix:@"5"]) {
            // iOS 5.* -> tested
           sqlite3_prepare_v2(database, sql5, -1, &statement, NULL);
        } else {
            // iOS != 5.* -> untested!!!
            sqlite3_prepare_v2(database, sql4, -1, &statement, NULL);
        }

        // Use the while loop if you want more than just the most recent message
        while (sqlite3_step(statement) == SQLITE_ROW) {
            if (sqlite3_step(statement) == SQLITE_ROW) {
                char *content = (char *)sqlite3_column_text(statement, 0);
                text = [NSString stringWithCString: content encoding: NSUTF8StringEncoding];
                sqlite3_finalize(statement);
            }
        }

        sqlite3_close(database);
    }

    showsms.text=text;
    NSLog(@"test");
}

但我无法访问SMS.DB,我搜索了互联网,但没有人有这样的问题,PLZ任何人都对我的问题有任何想法写我的代码或告诉我他的方式。

but i cant access the "SMS.DB", i have searched on the internet but no one have a problem like this, plz anyone have any idea about my issue write my the code or tell me his way.

谢谢

推荐答案

应用程序沙箱不允许你访问该文件。即使你确实让它发挥作用,苹果公司也不允许在商店里使用它。

The app sandbox doesn't allow you to access that file. Even if you did get it to work, Apple wouldn't allow it in the store.

这篇关于在我的应用中阅读iphone消息收件箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆