xmlparsing错误,同时使用wcf框架的Web服务

这是第一次,而我的工作在iOS应用程序的wcf肥皂服务,当尝试发送xml到服务器使用post方法时,我的iOS边代码看起来像这样 NSString *soapMessage = [NSString stringWithFormat:@"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body><SaveAllRecords33><xmlData></xmlData></SaveAllRecords33></SOAP-ENV:Body></SOAP-ENV:Envelope>"]; NSURL *url = [NSURL URLWithString:@"http://webservice.net2survey.com/servicejson.svc/SaveAllRecord33"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]]; [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [theRequest addValue: @"urn:ServiceJSON/SaveAllRecords33" forHTTPHeaderField:@"SOAPAction"]; [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 并在.net方面是这样的 [WebInvoke(Method = "POST", BodyStyle […]

构build时将文件复制到XCode项目的根目录

我正在尝试在iOS应用中实施Google Analytics(GA)。 我有两个不同的目标,对GA有不同的跟踪标识。 GA需要将GoogleService-Info.plist (无法重命名)文件放置在应用程序文件夹结构的根目录中。 该文件包含跟踪ID。 但是,由于我有两个不同的目标,我需要有两个不同的跟踪ID。 我不能将两个文件命名为具有不同目标的相同名称的文件。 那么,有没有办法将另一个文件复制到构build过程的根目录中。 已经试过这个和类似的,但似乎并没有工作: 有什么build议么?

从Firebase数据库中获取随机孩子

我正在尝试使用Firebase 3和Swift 3来制作一个允许用户创build“testing”的应用程序,目的是从数据库中看到一个完全随机的testing。 我的桌子: Users: – uid – email tests – id – title – user_uid 我如何从“testing”中随机select任何孩子,这样我就可以将它们展示给用户? 我应该改变我的结构吗? 通过这个我的意思是让我说我​​有这个: tests: – 12391239123 – title: "My first test" – user_uid: 12312345 – 59696995883 – title: "Second test" – user_uid 12352355 我想select这两个对象中的一个,所以我可以将它们显示给用户。 它必须是完全随机的。 也有可能查询数据库,所以我得到所有的孩子,其中user_uid等于我提供的用户uid? 如果是这样,怎么样?

什么可以用?

什么可以与[UIDevice currentDevice] ,如uniqueIdentifier? 谢谢!

路线不显示在MKMapView?

我有这两个CLLocation之间添加MKMapView的路线的方法。 我有有效的pickUpDistanceLocation&dropOffDistanceLocation func addRoutesOverLayForMapView(){ var source:MKMapItem? var destination:MKMapItem? println("\(pickUpDistanceLocation)") println("\(dropOffDistanceLocation)") //i also tested with these locations //let sourcelocation = CLLocation(latitude: 40.7141667, longitude: -74.0063889) //let destinationLocation = CLLocation(latitude: 38.89, longitude: 77.03) CLGeocoder().reverseGeocodeLocation(pickUpDistanceLocation, completionHandler: {(placemarks,error)-> Void in if (error != nil) { println("Reverse geocoder failed with error" + error.localizedDescription) return } if placemarks.count > 0 { if […]

NSFetchedResultsController:多个FRC,更新时委派错误

目标:使用FRC,通过startDate (一个NSDate属性)对Section's进行sorting,但是希望Today的Section出现在Upcoming dates Section之前。 我使用瞬态属性sectionIdentifier跟踪了Apple的代码。 苹果的示例代码 。 并首先从这个项目开始: OneFRC 我很快意识到,这可能不可能与一个FRC(我可能是错的)。 接下来,我决定用3 FRCs 刺杀这个 : ThreeFRC 。 TableView sections现在显示在我想要的订单中: 第0部分: Today 第一部分: Upcoming 第二部分: Past 但是,添加数据会触发FRC委托,并且出现以下错误: CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Invalid update: invalid number of rows in section 0. The number […]

Swift – 如何在Firebase上按降序创buildsorting查询?

我正在使用Firebase和Alamofire,AlamofireImage将我的imageURL数据caching在内存上,并上传ImageShack。 我坚持创build降序查询试图做和search,但我找不到可能的描述。 这是我在Firebase上的testingref_post 。 childByAutoId() – userUid – imageUrl – 时间戳(我用这个创build的) *使用NSDate()。formattedISO8601是最好的方式或者你能build议我基本上处理它? 我如何在Firbase IOS / Swift中进行降序查询。 这是我的viewDidLoad : let query = DataService.ds.REF_POSTS.queryOrderedByChild("timestamp") query.observeEventType(.Value, withBlock: { snapshot in if let snapshots = snapshot.children.allObjects as? [FDataSnapshot] { self.posts = [] for snap in snapshots { if let postDict = snap.value as? Dictionary<String, AnyObject> { print(postDict) let post […]

如何确定什么时候所有的图像已经从Swift中的一组下载?

我正在使用PinRemoteImage库来下载填充collectionView图像。 我想基于图像高度dynamic更新单元格高度,所以我需要知道何时下载了所有图像,以便我可以重新加载/无效我的collectionViewLayout 。 什么是最好的方式来确定什么时候没有更多的图像下载? override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! PinCollectionViewCell cell.pinImage?.pin_updateWithProgress = true cell.pinImage?.image = nil if let pinImageURL = self.pins[indexPath.row].largestImage().url { cell.pinImage?.pin_setImageFromURL(pinImageURL, completion: ({ (result : PINRemoteImageManagerResult) -> Void in if let image = result.image { self.imageArray.append(image) }

布局问题,Autolayout启用,但似乎没有工作

以下是我在iPhone 6模拟器上运行的应用程序 正如你可能已经猜到它在iPhone 5上看起来不错。 Autoresize已经打开,但我不确定我是否完全理解这个概念,所以我可能会错过一些东西。 任何解决scheme的build议,表示赞赏。 我还为故事板结构添加了另一张图片。

出现键盘时,移动带有自动布局约束的文本字段

我有一个search栏文本字段和一个表格视图(谷歌自动完成),我想翻译时,键盘进入视图。 我成功地做到这一点,但是,我收到有关我的限制的警告/错误。 我在这个视图上通过故事板使用自动布局,并试图在显示/隐藏键盘之前/之后禁用/启用约束,但我仍然收到这些错误。 我没有正确禁用自动布局? 我遵循这个 SO响应中给出的内容。 override func viewDidLoad() { … NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name:UIKeyboardWillShowNotification, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name:UIKeyboardWillHideNotification, object: nil) … } func keyboardWillShow(sender: NSNotification) { self.pixieLabel.hidden = true self.searchBar.setTranslatesAutoresizingMaskIntoConstraints(true) self.startingTableView.setTranslatesAutoresizingMaskIntoConstraints(true) self.searchBar.frame.origin.y -= 150 self.startingTableView.frame.origin.y -= 150 } func keyboardWillHide(sender: NSNotification) { self.pixieLabel.hidden = false self.searchBar.setTranslatesAutoresizingMaskIntoConstraints(false) self.startingTableView.setTranslatesAutoresizingMaskIntoConstraints(false) self.searchBar.frame.origin.y += 150 self.startingTableView.frame.origin.y += […]