Tag: 目标C

用Unity编写XML文件到iOS(使用C#)

我正在尝试在iOS上写入XML,但似乎是不可能的。 尝试了几个不同的这个,但没有工作。 我已经阅读,iOS只有写/访问它的/ Documents文件夹,所以我试图设置一个Application.dataPath到Documents文件夹。 但是我在Xcode中得到这个错误: DirectoryNotFoundException: Could not find a part of the path "/Users/mariusmathisen/Library/Application Support/iPhone Simulator/7.1/Applications/6AE4AF70-EFDF-46F0-9947-5C0936F3AD27/DaXml.app/Data/Documents/gamexmldata.txt". 这是我写入XML的代码: lic void WriteToXml() { Debug.Log ("Du nådde metoden"); //string filepath = Application.dataPath + @"/Data/gamexmldata.xml"; XmlDocument xmlDoc = new XmlDocument(); GameControl.control.outputXml = "Du nådde WriteXML"; if(File.Exists(Application.dataPath + "/Documents/gamexmldata.txt")) { Debug.Log("Filen Fantes"); GameControl.control.outputXml = "DU ER I Writetoxml og […]

查询应用程序的购买历史清单

我开发了几个应用程序,这些应用程序在appstore上运行。 现在我想开发一个主要的应用程序,其中包括现有的应用程序,在应用程序内购买以及其他应用程序内购买。 说明 : 我已经在AppStore上发布了5个课程作为独立的应用程序。我们说这个名字是a,b,c,d,e 我想创build一个包含各种课程的主应用程序“MAIN”,这些课程包括(但不限于)a,b,c,d,e的课程。 这些课程将作为inapp购买提供。 我想给那些已经购买了我以前的应用程序a,b,c,d或e的用户免费的课程。 例如:如果用户已经购买了应用程序a,b和c,现在他下载了“Main”。 然后在“Main”中,课程a,b和c可以在没有任何应用程序购买费用的情况下启用。 最初,我想到了canOpenURL / url计划方法,其中我将通过主应用程序查询a,b,c,d或e是否存在。 如果有任何/所有的应用程序存在,那么对应于这些应用程序的课程将在主应用程序中免费下载。 我在testing过程中执行了相同的工作。 canOpenURl中的问题是它是特定于设备的。 如果用户在iPhone 5上安装a,b和c并在iPad上安装主应用程序,该怎么办? 在这种情况下,如何通过主应用程序知道用户是否安装了a,b和c? 我的限制是,我不能要求用户的电子邮件,密码或任何types的唯一标识符。 是否有可能查询应用程序的购买历史logging(而不是应用程序内购买),以便我可以过滤由我开发的用户购买的应用程序? 很明显,如果通过要求用户给他们的Apple-ID通过。 我明白,但这有可能吗?

如何在iOS中以url的forms发布数据?

我想发送我的UITextfields数据到服务器。 我想发布数据,但服务器显示错误消息给我。 请检查我的代码: … NSURL *url=[NSURL URLWithString:@"http://projectsatseoxperts.net.au/fishing/api/postRegister.php"]; NSString *post =[[NSString alloc] initWithFormat:@"FirstName=%@&LastName=%@userName=%@&Email=%@Phone=%@&Address=%@Password=%@&ConfirmPassword=%@", txt_firstname.text,txt_lastname.text,txt_username.text,txt_email.text,txt_phone.text,txt_address.text,txt_password.text,txt_confirmpassword.text]; NSLog(@"Post is: %@",post); NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSLog(@"postData is: %@",postData); NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"postLength is: %@",postLength); NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:url]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; //[request setValue:@"http://projectsatseoxperts.net.au/fishing/api/postRegister.php" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSLog(@"request is: […]

如何从颜色select器方法设置button的颜色?

我在for循环中生成了一些button,每个button都有自己的标签。 现在我想点击一个button并打开一个颜色select器并设置button的颜色。 我的问题是,当我打开颜色select器,并select一种颜色,它被设置在不同的button。 我想点击一个button,只select点击button的颜色。 我使用的代码是: for(int i=0;i<=5;i++){ btnphoto=[[UIButton alloc]initWithFrame:CGRectMake(10,(30*i)+110,50,20)]; [btnphoto setTitle:@"Photo" forState:UIControlStateNormal]; [btnphoto setBackgroundColor:[UIColor redColor]]; [btnphoto addTarget:self action:@selector(buttonPressPickColor:) forControlEvents:UIControlEventTouchUpInside]; btnphoto.tag=100 + i; [self.view addSubview:btnphoto]; } -(IBAction)buttonPressPickColor:(UIButton*)sender { btnphoto.tag = sender.tag; NSLog(@"Btn photo Tag = %d",sender.tag); NEOColorPickerViewController *controller = [[NEOColorPickerViewController alloc] init]; controller.delegate = self; controller.selectedColor = self.currentColor; controller.title = @"Color Picker"; UINavigationController* navVC = [[UINavigationController […]

代表里面的Obj-C代表

我已经subclassed视图,我使用的标题视图它有一些button委托里面,它的作品完美。 不过,我在我的viewController上面提出了一个modalViewController。 (在我的modalViewController中,我已经实现了相同的头文件,并且它从头文件中获取委托),但是如果按下了头文件的后退button,它必须委托给前一个viewController。 我做了相同的function,但我的viewController从来没有得到它的代表… :(我是相当新的Obj-C,我不知道也许我在这里做一些非法的事情。 这里是modalViewController试图委托给以前的viewController的代码 #pragma mark – header delegate – (void)header:(header *)header backbuttonPressed:(UIButton *)sender { if(header == logo) { NSLog(@"gotBackButtonDelegate"); //delete the items array //_itemSourceArray = nil; [delegate allEventsDrillPage:self backbuttonPressed:sender]; [self dismissViewControllerAnimated:YES completion:nil]; } } 这个委托从页眉视图触发。 不过在我以前的viewController中: – (void)allEventsDrillPage:(allEventsDrillPage *)allEventsDrillPage backbuttonPressed:(UIButton *)sender //doesn't work 🙁 { NSLog(@"got back delegate!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); // [self dismissViewControllerAnimated:YES completion:nil]; […]

与GameplayKit的障碍

这是我的问题: 如何将一个SKSpriteNode数组转换成一个SKSpriteNode数组,以便代理人可以通过使用goalToAvoidObstacles:(nonnull NSArray<GKObstacle *> *) maxPredictionTime:(NSTimeInterval)来适当地避免这些障碍goalToAvoidObstacles:(nonnull NSArray<GKObstacle *> *) maxPredictionTime:(NSTimeInterval) /? 看来,我创buildGKObstaclearrays的方式不允许GKGoal正确地将这些障碍物识别为障碍物,无论我给目标带来多大的体重。 我目前有几个SKNode被添加到SKScene chapterScene 。 每个节点都被添加到我正在存储的数组中,名为obstacArray 。 我以下面的方式build立了一个很好的testing: 工作障碍 – (void)didMoveToView:(nonnull SKView *)view { [super didMoveToView:view]; // Add three obstacles in a triangle formation around the center of the scene. NSArray<GKObstacle *> *obstacles = @[ [self addObstacleAtPoint:CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame) + 150)], [self addObstacleAtPoint:CGPointMake(CGRectGetMidX(self.frame) – 200, CGRectGetMidY(self.frame) […]

如何获得配对的蓝牙设备

我想创build一个应用程序,在我的应用程序中显示配对的设备(例如在检测并显示我之前配对我的任何设备)。下一次,我想发送一个NSString如“hello”)到配对设备。 我在谷歌search,我很困惑! 请先告诉我如何与我的手机配对设备,以及如何发送NSString值给他们。

从Core Audio Callback更新UI的最佳做法是什么?

我目前正在围绕Core Audio进行包装,并且遇到了如何更新GUI AudioQueueInputCallback的问题。 首先,我想用麦克风的电平表读数来更新标签。 在我的代码中,我将当前的电平表值存储在每个callback的结构中。 func MyAudioQueueInputCallback(inUserData: UnsafeMutablePointer<Void>, inAQ: AudioQueueRef, inBuffer: AudioQueueBufferRef, inStartTime: UnsafePointer<AudioTimeStamp>, var inNumberPacketDesc: UInt32, inPacketDesc: UnsafePointer<AudioStreamPacketDescription>){ var error: OSStatus if (inNumberPacketDesc > 0){ error = AudioFileWritePackets(MyRecorder.recordFile, false, inBuffer.memory.mAudioDataByteSize, inPacketDesc, MyRecorder.recordPacket, &inNumberPacketDesc, inBuffer.memory.mAudioData) checkError(error, operation: "AudioFileWritePackets Failed ") // Increment the packet index MyRecorder.recordPacket += Int64(inNumberPacketDesc) if (MyRecorder.running){ error = AudioQueueEnqueueBuffer(inAQ, inBuffer, inNumberPacketDesc, […]

iOS – SIP呼叫的UILocalNotification

我有一个VoIP应用程序。 这个应用程序一切正常。 当应用程序在前台来电时,我正在收到SIP通知并显示“呼叫”对话框。 但问题是: 当我的应用程序在后台和来电时,我正在获取SIP通知。 如何提示给用户。 请帮帮我。

Monotouch / Xamarin绑定inheritance

我试图为FastPDFKit实现一个monotouch绑定。 我遇到了一个inheritance的构造函数的问题。 我试图从fastPDFKit绑定“ReaderViewController”。 ReaderViewControllerinheritance自从UIViewControllerinheritance的MFDocumentViewController。 我的C# NSUrl fullURL = new NSUrl (fullPath); FastPDFKitBinding.MFDocumentManager DocManager = new FastPDFKitBinding.MFDocumentManager (fullURL); DocManager.EmptyCache (); //line where the errors occur FastPDFKitBinding.ReaderViewController pdfView = new FastPDFKitBinding.ReaderViewController (DocManager); pdfView.DocumentID = PageID.ToString (); Source.PView.PresentViewController(pdfView, true, null); 此代码不会生成,当我使新的ReaderViewController时给我两个错误: Error CS1502: The best overloaded method match for `FastPDFKitBinding.ReaderViewController.ReaderViewController(MonoTouch.Foundation.NSCoder)' has some invalid arguments (CS1502) (iOSFlightOpsMobile) Error CS1503: […]