开发者

How we can simulate a USB/Wifi connection (between iPad and Mac) on iPhone simulator to test my app being shown as file sharing apps in iTune

开发者 https://www.devze.com 2023-01-24 08:45 出处:网络
When an iPad is connected to another Mac (through USB/Wifi), iTune application comes in picture and lists all the file sharing app.

When an iPad is connected to another Mac (through USB/Wifi), iTune application comes in picture and lists all the file sharing app. I am trying to create file sharing application for iOS.

I am unable to figure out how we can simulate this USB/Wifi connection on iPhone simulator to test my app being shown as file sharing apps in iTune. Is it even possible to test this iTune display on iPhone simulator?

Please suggest a better appro开发者_Python百科ach if this is not possible.

I am new iPad dev, please help. Thanks a lot.


As far as I know, it is not possible to connect the iPhone simulator to iTunes.

However, There is a workaround to -partially- test the filesharing functionality. When the simulator is started, the iPhone simulator filesystem is mapped into your OSX filesystem. Therefore you can copy files to and from the "documents" folder, that is where the files shared via iTunes are located.

In order to know the actual path in your filesystem, write the following lines of code in some place that gets executed early (applicationDidFinishLaunching is a good candidate):

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSLog(@"paths = %@", paths);  

This will dump to the console the actual path for the Documents directory. You copy this path and use Finder "Go to Folder" option to open this folder.

Now you can use Finder to copy files from and to this folder in the same way that iTunes does.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号