小编Gle*_*enn的帖子

iPhone通话记录/历史记录

我正在研究iPhone应用程序的可行性,并且在Apple的文档中找不到任何迹象表明iPhone应用程序可以读取手机的通话记录,特别是号码,时间和持续时间......我还需要SMS的相同信息.

首先:我已经完成了我的研究并用Google搜索,在这个网站上搜索过!我知道这个问题之前已被问过很多次,答案总是:"它无法完成"(至少不是在非越狱的iPhone上).

我搜索了包括核心电话在内的API,但我自己也找不到任何东西.

那么为什么这个问题?因为App Store中的这个应用程序似乎没有问题...:http://itunes.apple.com/us/app/callog/id327883585mt = 8

iphone api logging history phone-call

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

dyld:未加载库:@ rpath/SwiftyJSON.framework/SwiftyJSON

这是问题的续集:dyld:未加载库:@ rpath/SwiftyJSON.framework/SwiftyJSON

从头开始重建项目(新项目,新podfile,新文件,但在每个文件中复制 - 粘贴原始项目中的源代码),应用程序现在编译并在每个模拟器上完美运行!没有错误.

无论是在iPhone 4S上运行还是在iPad 2上运行,我都会遇到同样的错误,但原因不同:

dyld: Library not loaded: @rpath/SwiftyJSON.framework/SwiftyJSON
  Referenced from: /private/var/mobile/Containers/Bundle/Application/EFC891F9-C22B-4503-8F11-F30769183439/Demo Mobile.app/Demo Mobile
  Reason: Incompatible library version: Demo Mobile requires version 2.0.0 or later, but SwiftyJSON provides version 1.0.0
Run Code Online (Sandbox Code Playgroud)

(LLDB)

我的Podfile中的框架:

pod 'Alamofire' , '~> 1.3'
pod 'MBProgressHUD', '~> 0.9.0'
pod 'SwiftyJSON', '~> 2.2.1'
pod 'SQLite.swift', git: 'https://github.com/stephencelis/SQLite.swift.git'
Run Code Online (Sandbox Code Playgroud)

ios swift swifty-json

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

适用于iOS和MacOS X的应用程序

我将创建一个应用程序,它将启动它作为iPhone应用程序的生活.然后将开发具有非常类似功能的OS X应用程序.这两个应用程序将共享大量代码库并严重依赖存储在Core Data中的内容,因此将所有内容存储在一个Xcode项目中似乎合乎逻辑.

Q1.这是个好主意吗?可以吗?设置它的最佳方法是什么?

Q2.我正在寻找通过iCloud同步核心数据内容(在iPhone应用程序和OS X应用程序之间),有人能指出我如何工作的一个很好的来源(我是一个注册的Apple开发人员,但似乎无法找到它)

Q3.如果我开始使用通用应用程序或稍后将其转换,iPad版本可能会稍后推出?

iphone macos ipad ios

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

放置对象映射的位置(在RestKIt中)

由于我不想劫持另一个线程,因此我提出了关于映射的问题.

首先阅读:在RestKit中放置对象映射的最佳位置

我确信布莱克沃特斯给出的答案很可能是非常正确的,因为他是一个比我更聪明,更有经验的人,但对我来说,逻辑告诉我把映射放在每个模型中:如果你改变模型中的某些东西,你只是一个滚动来改变你的映射.

在我的AppDelegate中,我只需在每个模型中调用initMappings(或任何你想要调用的东西).

mapping objective-c restkit

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

dyld:未加载库:@ rpath/SwiftyJSON.framework/SwiftyJSON

我一直在使用模拟器测试我的应用程序.今天我决定使用模拟器中的其他设备对其进行测试,令我惊讶的是,它在某些设备上的启动时崩溃了,而在其他设备上它完美运行

我的应用程序构建运行:

  • iPad Air
  • 可调整大小的iPad
  • iPhone 5S
  • iPhone 6
  • iPhone 6plus
  • 可调整大小的iPhone

我的应用程序崩溃:

  • iPad 2
  • iPad Retina
  • iPhone 4S
  • iphone 5

我得到的错误是:

dyld:未加载库:@ rpath/SwiftyJSON.framework/SwiftyJSON

Referenced from: /Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Demo Mobile
Reason: no suitable image found.
(lldb) 
Run Code Online (Sandbox Code Playgroud)

有时我甚至得到更多信息:

Referenced from: /Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Demo Mobile
Reason: no suitable image found.  Did find:
/Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Frameworks/SwiftyJSON.framework/SwiftyJSON: mach-o, but wrong architecture
/Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Frameworks/SwiftyJSON.framework/SwiftyJSON: mach-o, but wrong architecture
/Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Frameworks/SwiftyJSON.framework/SwiftyJSON: mach-o, but wrong architecture
(lldb) 
Run Code Online (Sandbox Code Playgroud)

我通过Cocoapods安装了SwiftyJson.我的Podfile包含

platform :ios, '8.0'
use_frameworks!

pod 'SQLite.swift', git: 'https://github.com/stephencelis/SQLite.swift.git'

target 'thinx Mobile' do …
Run Code Online (Sandbox Code Playgroud)

ios swift swifty-json

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

无法构造“错误”,因为它没有可访问的初始值设定项

不确定这是我的代码中的错误还是 XCode 中的故障。

我有这个类(为了清楚起见的简化版本)

public class Error {

    let errors: [ (title: String, message: String)] =
        [("Some error title","Some error message"),
         ("Another error title", "Another error message") 
        ]

    var errorNo : Int

    init (_ errorNo: Int) {

        self.errorNo = errorNo
    }

    func title () -> String {
        return self.errors[self.errorNo].title
    }

    func message () -> String {
        return self.errors[self.errorNo].message
    }
}
Run Code Online (Sandbox Code Playgroud)

在另一堂课我有

if someCondition {
    return Error (0)
}
Run Code Online (Sandbox Code Playgroud)

现在奇怪的是......一切都编译并运行,但如果我让 XCode 闲置一会儿(不是我使用的最快的计算机),XCode 会给我臭名昭著的红点(带有感叹号)并显示错误:

无法构造“错误”,因为它没有可访问的初始化程序

每次我做 Error(0) (无论我在构造函数中使用什么 Int )

我可以再次编译并运行,错误消失然后重新出现

使用 …

xcode swift3

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

使用Core Data同步网站> iPhone应用程序的一种方法

我正在构建一个带有数据库的iPhone应用程序(我很可能第一次使用Core Data,但仍然可以证明我将根据你的答案使用SQLite).

应该从一些在线存储(很可能是MySQL数据库)定期更新此数据库的内容.

由于初始数据库相当大,它将在应用程序中,因此用户无需下载,更新将相当小,以便可以下载.您可以看到"Delta"更新是必须的(每次下载整个数据集的数据太多).更新将包含一些新记录,并最终对现有记录进行一些更正

本地数据库将有一些需要更新的表/实体(它们之间有很多关系),这些表/实体将是只读的(*).将有另外几个表/实体,用户可以在其中输入注释(读/写)但它们永远不必更新,这是私有用户数据.事实上,我有时会创建一个只有1-1关系的额外表,以保持良好的分离(数据集表/实体与注释表/实体).

有人可以为我提供一种在线生成文件的方法,其中包含数据库中的所有更改,可以下载到手机并有效地正确解析,以便应用这些更改/新记录.我一直在想类似于Rails用于维护其数据库的迁移,但似乎找不到任何看起来干净和高效的东西.记住不同表/实体之间的数据关系是非常重要的,这是我的灵感失败...

(*)对于开始只读,稍后用户将能够添加记录并进行编辑.他永远无法编辑现有记录,他自己的记录也不需要返回服务器.

database iphone sync core-data

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

枚举给出了 Vapor 4 和 Fluent 的错误

这让我很困惑:

\n

我有一个模型,我想在其中使用枚举。我首先声明枚举:

\n
enum MenuChoices: String, Codable {\n    case reachableAt\n    case attentionTo\n    case reasonVisit\n    case reasonProblem\n}\n
Run Code Online (Sandbox Code Playgroud)\n

然后是我的班级领域:

\n
@Enum(key: "menu_choices")\nvar menuChoices: MenuChoices\n
Run Code Online (Sandbox Code Playgroud)\n

然后我使用迁移在数据库中创建它:

\n
struct CreateUserMenu: Migration {    \nfunc prepare(on database: Database) -> EventLoopFuture<Void> {\n    return database.enum("menu_choices")\n        .case("reachable_at")\n        .case("attention_to")\n        .case("reason_visit")\n        .case("reason_problem")\n        .create()\n        .flatMap { menu_choices in\n            return database.schema("user_menus")\n                .id()\n                .field("created_at", .datetime, .required)\n                .field("updated_at",.datetime, .required)\n                .field("deleted_at",.datetime)\n                .field("menu_choices", menu_choices)\n                .field("be_nl", .string)\n                .field("be_fr", .string)\n                .field("en_us", .string)\n                .create()\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

到目前为止,一切都很好。此迁移有效并且数据库看起来正常。但是当我想添加一些数据以在另一个迁移中为数据库提供种子时,我收到错误:

\n
let test = UserMenu( menuChoices: MenuChoices.reachableAt, beNl: "nl", …
Run Code Online (Sandbox Code Playgroud)

enums vapor vapor-fluent

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

测试中的 NSDate 比较

我正在编写一些测试,以查看人员对象是否正确保存到本地数据库中(SQLite,使用字符串作为日期)。

在我的测试中,我有:

let testPerson = Person(firstName:"John", lastName:"Doe")
Run Code Online (Sandbox Code Playgroud)

保存到数据库后,我测试是否 createdAt != nil

那没问题!然后 :

let testPerson2 = Person.LoadByID(testPerson.id)
Run Code Online (Sandbox Code Playgroud)

这是一个静态函数,从数据库加载一个人对象到 testPerson2

所有字段都在测试中传递(因此它们对于 testPerson 和 testPerson2 完全相同,除了 createdAt 和 updateAt 日期

如果我对这些日期进行打印,它们完全相同:

testPerson.createdAt : Optional(2015-08-14 12:03:01 +0000)
testPerson2.createdAt :Optional(2015-08-14 12:03:01 +0000)
Run Code Online (Sandbox Code Playgroud)

但是测试(通过两种不同的方法):

XCTAssert(testPerson2.createdAt == testPerson.createdAt, "createdAt should be the same")
Run Code Online (Sandbox Code Playgroud)

或者

XCTAssertTrue(testPerson2.createdAt!.isEqualToDate(testPerson2.createdAt!), "createdAt should be the same")
Run Code Online (Sandbox Code Playgroud)

失败

使用 2x testPerson 或 testPerson2 进行这些测试,成功

我还尝试了以下代码:

if testPerson.createdAt!.compare(testPerson.createdAt!) == NSComparisonResult.OrderedDescending
        {
            println("date1 after date2");
        } else if testPerson.createdAt!.compare(testPerson.createdAt!) ==     NSComparisonResult.OrderedAscending
        {
            println("date1 before date2"); …
Run Code Online (Sandbox Code Playgroud)

unit-testing nsdate swift sqlite.swift

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

在iPhone上锁定sqlite文件

到目前为止,我的所有数据库访问都已读取,但现在我需要更新(并在此插入之后)

我在app目录中有一个包含'shows'的数据库(只读),这对我来说没问题(我不想将它复制到文件夹中,因为它相当大,我不需要更改其中的内容.

但我希望用户选择一些节目作为他的最爱.因此,我在documents文件夹中创建了一个带有'favorite_shows'表的数据库.它包含4个字段:ID(prim键)show_id is_favorite备注(当前尚未使用)

用户能够切换'is_favorite'状态ONCE,之后我在尝试更新时遇到错误:

SQLITE_BUSY 5/*数据库文件被锁定*/

这是我的代码:

if (sqlite3_open([databasePath UTF8String],&database) == SQLITE_OK){
    sqlStatement = "select * from favorite_shows WHERE (show_id = ?)";
    if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
        sqlite3_bind_int(compiledStatement, 1, self.ID);
        // search for a show
        if(sqlite3_step(compiledStatement) == SQLITE_ROW) {
            // if we can find one, toggle the status
            favID       = sqlite3_column_int(compiledStatement, 0); // we need the primary key to update it
            isFav       = (sqlite3_column_int(compiledStatement, 2) == 1); // let's store the favorite status

            sqlStatement = "update …
Run Code Online (Sandbox Code Playgroud)

sqlite iphone

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

对于Objective-C中的循环

counter = [myArray count];
for (i = 0 ; i < count ;  i++) {
     [[anotherArray objectAtIndex:i] setTitle:[myArray objectAtIndex:i]];
}
Run Code Online (Sandbox Code Playgroud)

我想以客观的C 2.0方式做到这一点,但似乎无法找到如何访问索引'i'(如果可能的话).

for (NSString *myString in myArray) {
     [[anotherArray objectAtIndex:i] setTitle: myString];
}
Run Code Online (Sandbox Code Playgroud)

(请原谅任何错别字;我目前不在我的Mac后面,所以这不在我的脑海里.)

cocoa objective-c

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