NSJSONSerialization和表情符号

我目前正在尝试将一些包含emojis的JSON发布到python API。 我试图直接从包含我的UITextField表情符号的string喂NSJSONSerialization ,但串行器崩溃没有任何意义的解释。 之后,我试图做一些格式转换,并结束了这样的事情: NSString *uniText = mytextField.text; NSData *msgData = [uniText dataUsingEncoding:NSNonLossyASCIIStringEncoding]; NSString *goodMsg = [[NSString alloc] initWithData:msgData encoding:NSUTF8StringEncoding] ; 这基本上工作,除了所产生的UTF-8是有点双“逃脱”,导致以下: "title":"\\ud83d\\udc8f\\ud83d\\udc8f\\ud83d\\udc8f\\ud83d" 任何build议如何解决这个问题?

Cocoa错误2048在cocoa中使用NSRegularExpression

我正在build立一个正则expression式在iOS应用程序的parsing器中使用。 这是我的代码: NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(?<=#EXT[^\r\n]*[\r\n]+)[^#][^\r\n]+" options:NSRegularExpressionAnchorsMatchLines error:&regexError ]; if (regexError) { NSLog(@"regexError: %@", regexError); return nil; } 从这个答案 。 这给出了这个错误: regexError: Error Domain=NSCocoaErrorDomain Code=2048 "The operation couldn't be completed. (Cocoa error 2048.)" UserInfo=0x8e86670 {NSInvalidValue=(?<=#EXT[^ cocoa错误2048是一个NSFormattingErrorMinimum 根据文档 …但是没有进一步的解释。 这是什么意思?

AVPlayer播放单声道audio立体声 – >单声道

在我的iPad / iPhone应用程序中,我使用AVPlayer播放video。 video文件有一个立体声音轨,但我只需要在单声道播放此音轨的一个通道。 部署目标是iOS 6.我怎样才能做到这一点? 非常感谢你的帮助。

核心audio:当一个数据包= 4个字节时,一个数据包如何能够=一个字节

我正在学习核心audio中的核心audio转换服务,我在他们的示例代码中被这个例子所震惊: while(1) { // wrap the destination buffer in an AudioBufferList AudioBufferList convertedData; convertedData.mNumberBuffers = 1; convertedData.mBuffers[0].mNumberChannels = mySettings->outputFormat.mChannelsPerFrame; convertedData.mBuffers[0].mDataByteSize = outputBufferSize; convertedData.mBuffers[0].mData = outputBuffer; UInt32 frameCount = packetsPerBuffer; // read from the extaudiofile CheckResult(ExtAudioFileRead(mySettings->inputFile, &frameCount, &convertedData), "Couldn't read from input file"); if (frameCount == 0) { printf ("done reading from file"); return; } // […]

添加到手机上的主屏幕

我如何编码一个button,特别是在iPhone和Android手机上创build一个快捷方式。 我正在使用样板作为框架,所以它会自动将它添加到头部<link rel="shortcut icon" href="img/l/apple-touch-icon.png"> 。 我认为这将是我使用的默认图标。 现在我有一个button,在我的HTML设置是这样的 <a href="#"><img src="img/button-shortcut.jpg" /></a> 我不知道该怎么把我的href或者我应该使用JavaScript来实现它。 我也不确定什么是合适的术语,我只是猜测它被称为“捷径” 我想要实现的是,我有一个简单的Web应用程序(纯HTML),我有一个button,以在他们的主屏幕上添加一个快捷方式/图标。 这样,他们更容易访问我的网站/networking应用程序。 我的目标设备主要是iphone和android。 有人可以启发我吗? 谢谢!

iOS应用程序崩溃的苹果审查小组,但不是在我的设备上

我的应用程序没有崩溃在我的iDevices,但苹果审查小组说,它崩溃在iPad 6.0.1。 这是resymbolicated日志的相关部分: Last Exception Backtrace: 0 CoreFoundation 0x327fb29e __exceptionPreprocess + 158 1 libobjc.A.dylib 0x394dd97a objc_exception_throw + 26 2 UIKit 0x38897d54 +[UIStoryboard storyboardWithName:bundle:] + 436 3 UIKit 0x386da406 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 38 4 UIKit 0x38563794 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 524 5 UIKit 0x3850bc34 -[UIApplication handleEvent:withNewEvent:] + 1000 6 UIKit 0x3850b6c8 -[UIApplication sendEvent:] + 68 7 UIKit […]

方向错误地在viewDidLoad中报告

所以我有一个应用程序需要加载不同的图像作为背景图像取决于设备的方向。 我在viewDidLoad中有以下代码: BOOL isLandScape = UIDeviceOrientationIsLandscape(self.interfaceOrientation); if (isLandScape) { self.bgImage.image = [UIImage imageNamed:@"login_bg748.png"]; } 由于某些原因,即使模拟器在风景中启动,这个布尔仍然是错误的。 我检查过,无论实际的模拟器方向如何,它总是报告为纵向模式。 有没有人有一个想法,为什么这是行不通的? 在shouldAutoRotateForInterfaceOrientation我有以下几点: if (UIDeviceOrientationIsLandscape(interfaceOrientation)) { self.bgImage.image = [UIImage imageNamed:@"login_bg748.png"]; } else { self.bgImage.image = [UIImage imageNamed:@"login_bg1004.png"]; } return YES; 而这个代码确实工作,它只是一个混乱的启动。 我执行一个旋转后,它工作正常。

使用谓词过滤基于另一个数组的NSArray

考虑下面的数组。 数组包含“Alpha”types的对象。 我们只关心NSStringtypes的属性username 。 NSArray *some_usernames = @[ <multiple values of type Alpha> ] NSArray *all_usernames = @[ <multiple values of type Alpha> ] 我基本上想要所有的用户名不在数组some_usernames ,即 NSArray *remaining_usernames = @[ <all_usernames but not in some_usernames> ]; 我打算这样做的方式是: NSPredicates *predicates; for (Alpha *alpha in some_usernames) { predicate = [predicate with @"username != %@", alpha.username]; predicates.add(predicate) } […]

如何在iOS应用程序中播放m3uaudiostream

我正在尝试使用Xcode 4.5.2创buildiOS / iPhone广播应用程序。 我想播放@“http://xx.xxxxxxx.com/8111/radio.m3u”播放,暂停,音量控制,并能够在后台function/多任务处理上播放。 AVFoundation ,我已经添加了AVFoundation , Mediaplayer和AudioToolBox框架。 我添加了play,暂停和滑块对象到xib。 ViewController.h @interface ViewController : UIViewController @property (strong,nonatomic) MPMoviePlayerController *myPlayer; @property (weak, nonatomic) IBOutlet UISlider *myslider; – (IBAction)playButtonPressed; – (IBAction)myslider:(id)sender; @end ViewController.m #import "ViewController.h" #import <MediaPlayer/MediaPlayer.h> @interface ViewController () { UISlider *volumeSlider; } @end @implementation ViewController – (void)viewDidLoad { [super viewDidLoad]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; UIBackgroundTaskIdentifier newTaskId […]

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath没有被调用

所以它真的很奇怪…我有一个名为ListEventsViewController的ViewController 在头文件中: @interface ListEventsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @property (weak, nonatomic) IBOutlet UITableView *eventsTable; @property (strong, nonatomic) NSArray *events; @end 在实现中,我打电话下面的几乎强制function: – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return [events count]; } – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = nil; cell = [eventsTable dequeueReusableCellWithIdentifier:@"eventCell"]; if(!cell){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle […]