我一直试图将两个NSDictionaries合并几个小时.搜索并发现我可以使用[NSMutableDictionary addEntriesFromDictionary:].
NSDictionary *areaAttributes = [[area entity] attributesByName];
NSDictionary *gpsAttributes = [[gps entity] attributesByName];
NSMutableDictionary *areaAttributesM = [areaAttributes mutableCopy];
NSMutableDictionary *gpsAttributesM = [gpsAttributes mutableCopy];
NSMutableDictionary *combinedAttributes = [areaAttributesM addEntriesFromDictionary:gpsAttributesM];
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
Initializing 'NSMutableDictionary *_strong' with an expression of incompatible type 'void'
Run Code Online (Sandbox Code Playgroud)
所以这就是[areaAttributesM addEntriesFromDictionary:gpsAttributesM]回报void?我的理解是否正确?为什么它回归无效?
使用Solr 3.5.0并在我的schema.xml中,我使用以下内容标记句子的结尾,并用符号标记替换结束标点符号:
<charFilter class="solr.PatternReplaceCharFilterFactory"
pattern="(?<=[^.!?\\s][^.!?]*(?:[.!?](?![']?\s|$)[^.!?]*)*)[.!?]+(?=\\s|$)"
replacement=" monkeysentence"/>
Run Code Online (Sandbox Code Playgroud)
我不确定这是否适用于我想要的东西,但首先我需要解决在第一个'?<='lookbehind中转义'<'字符的问题.
我收到以下错误:
org.xml.sax.SAXParseException: The value of attribute "pattern"
associated with an element type "null" must not contain the '<' character.
Run Code Online (Sandbox Code Playgroud)
我尝试使用'\',如下所示:
pattern="(?\<=[^.!?\\s][^.!?]*(?:[.!?](?![']?\s|$)[^.!?]*)*)[.!?]+(?=\\s|$)"
Run Code Online (Sandbox Code Playgroud)
但我得到了同样的错误.
我已将Container View拖到我的一个View Controllers上.这附带了一个嵌入式塞格.跑步产生这个:
'Could not instantiate class named UIStoryboardEmbedSegueTemplate'
Run Code Online (Sandbox Code Playgroud)
所以从其他几个stackoverflow问题看来,这似乎没有在iOS 5中实现.但是,这些问题没有提出修复.XCode不会让我使用任何其他类型的segue.
如果答案是创建自定义容器视图,我将继续使用它.在过去的几天里,我已经看到了很多代码.只是想知道是否有办法使用提供的Container View对象来做到这一点.
我正在尝试合并两个NSDictionaries:
NSDictionary *areaAttributes = [[area entity] attributesByName];
NSDictionary *gpsAttributes = [[gps entity] attributesByName];
NSMutableDictionary *combinedAttributes = [areaAttributes mutableCopy];
[combinedAttributes addEntriesFromDictionary:gpsAttributes];
Run Code Online (Sandbox Code Playgroud)
但是得到以下错误:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 'The key 'latitude' is not defined for this NSKnownKeysDictionary'
Run Code Online (Sandbox Code Playgroud)
latitude 是关键 gpsAttributes
这是我的viewcontroller.h文件:
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import <CoreLocation/CoreLocation.h>
#import <AVFoundation/AVFoundation.h>
#import <CoreMedia/CoreMedia.h>
#import <ImageIO/ImageIO.h>
#import <CoreVideo/CoreVideo.h>
@interface ViewController : UIViewController <UINavigationControllerDelegate, CLLocationManagerDelegate>
@property (nonatomic, strong) NSManagedObjectContext *managedObjectContext;
@property(nonatomic, weak) IBOutlet UIImageView *selectedImageView;
@property(nonatomic, retain) IBOutlet UIImageView *vImage;
@property(nonatomic, retain) AVCaptureStillImageOutput????? *stillImageOutput;
- (IBAction)photoFromAlbum;
- (IBAction)photoFromCamera;
- (IBAction)saveImageToAlbum;
- (IBAction)segueToChoosePhotoTypeViewController;
@end
Run Code Online (Sandbox Code Playgroud)
这条线:
@property(nonatomic, retain) AVCaptureStillImageOutput????? *stillImageOutput;
Run Code Online (Sandbox Code Playgroud)
正在产生以下问题:
Expected ; at end of declaration list.
Run Code Online (Sandbox Code Playgroud)
Xcode没有将AVCaptureStillImageOutput识别为类,因为它仍然是黑色并且不建议将其作为类型,并且"Fix-it"想要;在AVCaptureStillImageOutput之后插入右侧.
但是,如果我尝试使用声明AVCaptureStillImageOutput作为我的viewController.m文件的viewDidLoad中的类型,它会识别它并允许它作为类型.此外,其余的AVFoundation类在那里的代码中被识别.
框架就在那里,我只是对这个@property声明有一个问题.
我有一个包含大量条目的JSON文件,如下所示:
{
"area1": "California",
"area2": "Sierra Eastside",
"area3": "Bishop Area",
"area4": "Volcanic Tablelands (Happy/Sad Boulders)",
"area5": "Fish Slough Boulders",
"grade": "V6 ",
"route": "The Orgasm",
"type1": "Boulder",
"type2": "NONE",
"type3": "NONE",
"type4": "NONE",
},
Run Code Online (Sandbox Code Playgroud)
我想获取area和type条目并将它们转换为数组:
{
"area": ["California","Sierra Eastside","Bishop Area","Volcanic Tablelands (Happy/Sad Boulders)","Fish Slough Boulders"]
"grade": "V6 ",
"route": "The Orgasm",
"type": ["Boulder","NONE","NONE","NONE"]
},
Run Code Online (Sandbox Code Playgroud)
我有这个代码几乎可以工作:
json_data=open('../json/routes_test.json')
datas = json.load(json_data)
datas_arrays = []
area_keys = ['area1','area2','area3','area4','area5']
type_keys = ['type1','type2','type3','type4']
for data in datas:
areaArray = []
typeArray …Run Code Online (Sandbox Code Playgroud) 我正在按照以下教程:http: //mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/来设置带有ejabberd服务器的iOS应用程序.到目前为止,我已经将代码复制到一个新项目中.
我的问题是在手机上运行时没有调用XMPP委托函数AppDelegate.m.在Simulator中一切正常,并调用下面的两个函数.
- (void)xmppStreamDidConnect:(XMPPStream *)sender {
NSLog(@"in WSAppDelegate - xmppStreamDidConnect");
isOpen = YES;
NSError *error = nil;
[[self xmppStream] authenticateWithPassword:password error:&error];
}
- (void)xmppStreamDidAuthenticate:(XMPPStream *)sender {
NSLog(@"in WSAppDelegate - xmppStreamDidAuthenticate");
[self goOnline];
}
Run Code Online (Sandbox Code Playgroud)
我可以在手机和模拟器上连接,因为此调用运行时没有错误:
[xmppStream connect:&error]
Run Code Online (Sandbox Code Playgroud)
这是我的AppDelegate.h代码:
#import <UIKit/UIKit.h>
#import "XMPPRoster.h"
#import "XMPP.h"
#import "SMChatDelegate.h"
#import "SMMessageDelegate.h"
@class SMBuddyListViewController;
@interface WSAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
SMBuddyListViewController *viewController;
XMPPStream *xmppStream;
XMPPRoster *xmppRoster;
NSString *password;
BOOL isOpen;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, …Run Code Online (Sandbox Code Playgroud) 我有一个Photo Class和一个Comments Class.我正在尝试实现一种搜索,用户可以在其中检索包含带有某些单词的评论的照片.我想到了几种方法,最简单的似乎是在Photo Class中包含一个Comments对象数组.
但是,我无法弄清楚如何查询此注释对象数组以查询其关键的"内容".
做类似于创建注释字符串数组本身的方法可行,但出于一致性的原因,我宁愿保存指向注释的指针.
这是我第一次使用dispatch_group_t,我犯了一个简单的错误。dispatch_group_notify在任何异步调用返回之前被调用,因此甚至在第一个调用之前被调用dispatch_group_leave(group),然后抛出一个EXC_BAD_INSTRUCTION.
但是,我不知道为什么会发生这种情况。
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, queue, ^{
[self getCategoriesMainWithParameters:nil withSuccess:^(NSArray *objects) {
[categoriesMain addObjectsFromArray:objects];
dispatch_group_leave(group);
} failure:^(NSError *error) {
groupError = error;
dispatch_group_leave(group);
}];
});
dispatch_group_async(group, queue, ^{
[self getCategoriesSubWithParameters:nil withSuccess:^(NSArray *objects) {
[categoriesSub addObjectsFromArray:objects];
dispatch_group_leave(group);
} failure:^(NSError *error) {
groupError = error;
dispatch_group_leave(group);
}];
});
dispatch_group_async(group, queue, ^{
[self getCategoriesProductWithParameters:nil withSuccess:^(NSArray *objects) {
[categoriesProduct addObjectsFromArray:objects];
dispatch_group_leave(group);
} failure:^(NSError *error) {
groupError = error;
dispatch_group_leave(group); …Run Code Online (Sandbox Code Playgroud) objective-c ×5
ios ×3
xcode ×3
nsdictionary ×2
solr ×2
ejabberd ×1
ios5 ×1
java ×1
json ×1
nutch ×1
properties ×1
python ×1
regex ×1