小编Ken*_*ent的帖子

重新安装后Cocoapods错误读取〜/ .cocoapods/repos/master/CocoaPods-version.yml

我执行了我的正常pod update并收到以下消息:

[!] There was an error reading '~/.cocoapods/repos/master/CocoaPods-version.yml'.
Please consult http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/ for more information.
Run Code Online (Sandbox Code Playgroud)

所以我按照http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/中的说明进行操作

$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup
Setting up CocoaPods master repo
[!] There was an error reading '~/.cocoapods/repos/master/CocoaPods-version.yml'.
Please consult http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/ for more information.
Run Code Online (Sandbox Code Playgroud)

同样的错误.所以我删除了cocapods,升级了ruby和gem,安装了cocoapods:

$ sudo rm -fr ~/.cocoapods

$ sudo gem uninstall cocoapods
Remove executables:
    pod, sandbox-pod

in addition to the gem? [Yn]  y
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-0.35.0

$ sudo gem update --system …
Run Code Online (Sandbox Code Playgroud)

cocoapods

14
推荐指数
2
解决办法
2886
查看次数

RestKit使用setObjectMapping从核心数据中删除旧数据

我已经回顾了RestKit对象映射的答案:难以使用setObjectMapping:forResourcePathPattern:withFetchRequestBlock它正在工作,但仅适用于最后一次映射.例:

RKManagedObjectMapping *audioSourcesMapping = [RKManagedObjectMapping mappingForEntityWithName:kEntityAudioSources inManagedObjectStore:objectStore];
[audioSourcesMapping mapKeyPath:@"icon" toAttribute:@"icon"];
[audioSourcesMapping mapKeyPath:@"name" toAttribute:@"name"];
[audioSourcesMapping mapKeyPath:@"notes" toAttribute:@"notes"];
[audioSourcesMapping mapKeyPath:@"section" toAttribute:@"section"];
[audioSourcesMapping mapKeyPath:@"url" toAttribute:@"url"];
audioSourcesMapping.primaryKeyAttribute = @"name";
[wsiObjectManager.mappingProvider registerMapping:audioSourcesMapping withRootKeyPath:@"winSystem.winSystemAudioSources.winSystemAudioSource"];


[wsiObjectManager.mappingProvider setObjectMapping:audioSourcesMapping forResourcePathPattern:kWinSystemInfoXml 
                             withFetchRequestBlock:^NSFetchRequest *(NSString *resourcePath) {
                                 return [AudioSources fetchRequest];
                             }];


RKManagedObjectMapping *eventsMapping = [RKManagedObjectMapping mappingForEntityWithName:kEntityEvents inManagedObjectStore:objectStore];
[eventsMapping mapKeyPath:@"contact" toAttribute:@"contact"];
[eventsMapping mapKeyPath:@"startDate" toAttribute:@"startDate"];
[eventsMapping mapKeyPath:@"endDate" toAttribute:@"endDate"];
[eventsMapping mapKeyPath:@"icon" toAttribute:@"icon"];
[eventsMapping mapKeyPath:@"location" toAttribute:@"location"];
[eventsMapping mapKeyPath:@"name" toAttribute:@"name"];
[eventsMapping mapKeyPath:@"notes" toAttribute:@"notes"];
[eventsMapping mapKeyPath:@"section" toAttribute:@"section"];
[eventsMapping mapKeyPath:@"url" toAttribute:@"url"];
eventsMapping.primaryKeyAttribute = @"name";
[wsiObjectManager.mappingProvider …
Run Code Online (Sandbox Code Playgroud)

xml objective-c ios restkit

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

SwiftUI,iOS 14,表单中的键盘避免{ TextEditor() }

我在一个简单的Form{}. 自动键盘回避不起作用。下面是一个带有TextEditor(). 运行时,键盘位于输入字段的顶部,要求用户滚动视图以便输入位置。删除Form{}和自动键盘避免工作。我是否缺少在 Form{} 中执行的某些操作才能获得此行为?

import SwiftUI
struct ContentView: View {
    @State private var stopLocation: String = ""
    var body: some View {
        Form {
            let desc = "\n\n\n\n\n\n\n\n\n\n\n\nEnter Location"
            Text(desc)
            VStack {
                TextEditor(text: $stopLocation)
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

swiftui swiftui-form keyboard-avoidance

9
推荐指数
0
解决办法
356
查看次数

AWS SNS错误无效参数:令牌原因:端点xxx已存在,具有相同的令牌,但属性不同

使用适用于iOS的AWS SDK v2.0.8

快速提问:

我如何[snsClient deleteEndpoint:request],我不知道这个端点的阿尔恩?我确实有deviceToken.

详情:

Token Reason: Endpoint arn:aws:sns:...c6 already exists with the same Token, but different attributes尝试为iPhone创建端点时收到错误:

// Async call to create the platform endpoint
[[[_awsSnsClient createPlatformEndpoint:request] continueWithSuccessBlock:^id(BFTask *task) {
    // success
    _awsPlatformEndpoint = task.result; // Save off the endpoint data
    [self awsUsubscribeAllSubscriptions];
    return nil;
}] continueWithBlock:^id(BFTask *task) {
    if (task.error) {
        // failed with error
        ALog(@"Error: Code:%li localizedDesc:%@ Exception:%@", (long)task.error.code, task.error.localizedDescription, task.exception);
        if(task.error.code == 7) {
            // delete offending endpoint and create …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch amazon-web-services ios

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

addTarget:action:forControlEvents - TableView中的UISwitch - 发送者ok,事件总是0x0

使用此论坛中的精彩帖子,我在tableView中创建了一个switchView作为accessoryView.当触摸开关时,我的动作(switchChanged)被调用.只有发送方具有有效值,事件为0x0.

将目标添加到switchView:

        [switchView addTarget:self action:@selector(switchChanged:forEvent:) forControlEvents:(UIControlEventValueChanged | UIControlEventTouchDragInside)];
Run Code Online (Sandbox Code Playgroud)

那个行动:

- (void) switchChanged:(id)sender forEvent:(UIEvent *)event {
  if(event) {
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:[[[event touchesForView:sender] anyObject] locationInView:self.tableView]];
    IFDFlightlogFormQuestions *question = [self.resultsController objectAtIndexPath:indexPath];
    NSLog(@"IFDNewFlightlogViewController_Pad:switchChanged Switch is %@ xmlAttrib %@",[sender isOn],question.XmlAttrib);
    [self.xmlResults setValue:([sender isOn])?@"true":@"false" forKey:question.XmlAttrib];
  }
}
Run Code Online (Sandbox Code Playgroud)

使用action:@selector(switchChanged: forEvent:)- 增加空间 - 没有变化.

使用action:@selector(switchChanged::)- 删除forEvent- 无法识别的选择器.

我的目标是将indexPath放到tableView中,这样我就可以更改字典中的值.

我目前的解决方法是仅使用发件人信息,但我想要事件信息:

- (void) switchChanged:(id)sender forEvent:(UIEvent *)event {
    UISwitch *switchView = (UISwitch *)sender;
    UITableViewCell *cell = (UITableViewCell *)switchView.superview;
    UITableView *tableView = (UITableView *)cell.superview; …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uiswitch ios

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

iOS中的AWS v2 SNS - createPlatformEndpoint:request

当我在SNS控制台中设置端点时,我有推动工作.现在我开始允许iOS应用程序创建端点.然后是订阅.

问题是BFTask *task = [sns createPlatformEndpoint:request];返回,task.result是零,而不是AWSSNSCreateEndpointResponse*.BTW,task.error也是零.

来自.h文件:

  • @return BFTask的一个实例.成功执行后,task.result将包含AWSSNSCreateEndpointResponse的实例.执行失败时,task.error可能包含带有AWSSNSErrorDomain domian的NSError和以下错误代码:AWSSNSErrorInvalidParameter,AWSSNSErrorInternalError,AWSSNSErrorAuthorizationError,AWSSNSErrorNotFound.

亚马逊已经在SDK v2中为SNS创建了网络示例.所以我也在寻找可能使用SDK v2创建端点和订阅的一些示例的人.

应用程序启动后,我调用我的方法:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [self awsStartWithDeviceToken:deviceToken];
} 
Run Code Online (Sandbox Code Playgroud)

代码:

- (void)awsStartWithDeviceToken:(NSData *)deviceToken {

    // Get a hex string for the NSData deviceToken
    // http://stackoverflow.com/questions/7520615/how-to-convert-an-nsdata-into-an-nsstring-hex-string
    NSUInteger dataLength = [deviceToken length];
    NSMutableString *deviceTokenString = [NSMutableString stringWithCapacity:dataLength*2];
    const unsigned char *dataBytes = [deviceToken bytes];
    for (NSInteger idx = 0; idx < dataLength; ++idx) {
        [deviceTokenString appendFormat:@"%02x", dataBytes[idx]];
    }

    // Set the log level
    [AWSLogger …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch amazon-web-services ios

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